Skip to content

Add support for validator when creating collection. [DATAMONGO-1322] #2178

@spring-projects-issues

Description

@spring-projects-issues

Christoph Strobl opened DATAMONGO-1322 and commented

db.createCollection( "contacts", {
   validator: { $or:
      [
         { phone: { $type: "string" } },
         { email: { $regex: /@mongodb\.com$/ } },
         { status: { $in: [ "Unknown", "Incomplete" ] } }
      ]
   }
} )

NOTE: investigate usage if JSR-303 for defining validation to be propagated to the collection


Reference URL: https://docs.mongodb.org/master/release-notes/3.2/#validator

Issue Links:

Referenced from: pull request #525, and commits 0ce34d8, c3dbce4, 36614ef, 2024b30, b00054f, 5947980

1 votes, 3 watchers

Metadata

Metadata

Labels

in: coreIssues in core supportin: mappingMapping and conversion infrastructuretype: enhancementA general enhancement

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions