[SERVER-18227] Document Validation Created: 27/Apr/15  Updated: 28/Oct/15  Resolved: 15/May/15

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 3.1.3

Type: Task Priority: Major - P3
Reporter: Ian Whalen (Inactive) Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
is documented by DOCS-5961 add new 3.2 option bypassDocumentVali... Closed
Related
related to SERVER-20783 aggregate $out + validator error: wro... Closed
is related to DRIVERS-250 Support bypassDocumentValidation Closed
Backwards Compatibility: Minor Change
Sprint: Quint Iteration 3
Participants:

 Description   

This will add the ability for users to configure a match expression on collections that all new
documents and updates to existing documents must match. An attempt to create a document that doesn't
match the validation will fail with error code 121 (DocumentValidationFailure).

Validators can be set by passing the 'validator' option to the 'create' command. They can also be
changed or added by passing a 'validator' option to the 'collMod' command. Passing
validator: {} (a query that matches all documents) removes the validator from a collection. When a
validator is set on a collection we only validate new objects, not existing objects.

The following commands will support a new flag 'bypassDocumentValidation' which allows opting out of
validation on a per-operation basis, for example when restoring potentially invalid data from a
backup. This will require a new BypassDocumentValidation permission which is granted to the built-in
roles 'restore' and 'dbadmin'.

  • applyOps
  • clone
  • cloneCollection
  • copyDb
  • findAndModify
  • mapReduce
  • insert (only as command)
  • update (only as command)
  • aggregate (for $out)


 Comments   
Comment by Githook User [ 28/May/15 ]

Author:

{u'username': u'mgrundy', u'name': u'Mike Grundy', u'email': u'michael.grundy@10gen.com'}

Message: SERVER-18227 Document validation tests
Branch: master
https://github.com/mongodb/mongo/commit/814125d3b17017224c2e17c8cee778184b8af7a6

Comment by Mathias Stearn [ 15/May/15 ]

The only backward breaking change is that we now preserve collection options
when creating a new collection based on an existing one. The most visible
impact of this is that M/R and agg $out collections preserve the cappedness of
existing targets.

Drivers need to add support for the new 'bypassDocumentValidation' to the
following commands:

  • applyOps
  • clone
  • cloneCollection
  • copyDb
  • findAndModify
  • mapReduce
  • insert (only as command)
  • update (only as command)
  • aggregate (for $out)

Drivers also need to support the new 'validator' option to createCollection and collMod.

Drivers may also want to provide special error handling (distinct exception, etc) for error code 121 (DocumentValidationFailure). This should treated probably be similarly to dup-key errors.

Comment by Githook User [ 15/May/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-18227 Fix minor typos
Branch: master
https://github.com/mongodb/mongo/commit/a623935ccde96bbe77c893111b983e433091e662

Comment by Githook User [ 15/May/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-18227 Add bypassDocumentValidation support to applyOps
Branch: master
https://github.com/mongodb/mongo/commit/4f96c2817ac72f6d80458137acd8a90b5178e00a

Comment by Githook User [ 14/May/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-18227 Add bypassDocumentValidation option to commands that need it
Branch: master
https://github.com/mongodb/mongo/commit/463d3343d559590d60cfd5c48ac98ad675d5390e

Comment by Githook User [ 14/May/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-18227 Propagate all options when creating collections based on others

In addition to the primary goal of propagating the validator, this will also
propagate things like storage-engine specific options and capped settings.
Branch: master
https://github.com/mongodb/mongo/commit/22de12dd4ac510cd2a37b643eb528673f651e21b

Comment by Githook User [ 14/May/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-18227 Correctly parse collection options in RS rollback of collmod
Branch: master
https://github.com/mongodb/mongo/commit/b0f3a43bf7f9b4e1bd48c5b823ebe2d5e8fa9055

Comment by Githook User [ 08/May/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-18227 Implement RS rollback for collmod of flags and validator
Branch: master
https://github.com/mongodb/mongo/commit/c7ce2e2c56c5d39530456fbbb0554517afe9ab14

Comment by Githook User [ 08/May/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-18227 Ban setting a document validator on system collections
Branch: master
https://github.com/mongodb/mongo/commit/25402fd25514b319170ee822f1a630ed26fdf766

Comment by Githook User [ 08/May/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-18227 Add a mechanism to disable document validation and start using it

This does not necessarily cover all places that need to disable validation.
Branch: master
https://github.com/mongodb/mongo/commit/c5f317f59e41caffcd3972bc741abaa649229a5b

Comment by Githook User [ 08/May/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-18227 Initial part of document validation

This covers setting and changing the validator as well as enforcing it for
insert and update.
Branch: master
https://github.com/mongodb/mongo/commit/849b8f436a5178c5be6afc2a49e9a4d1ecf5d92b

Comment by Githook User [ 04/May/15 ]

Author:

{u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}

Message: SERVER-18227 Make OperationContext decorable
Branch: master
https://github.com/mongodb/mongo/commit/522d8fbdbba5389564e4f014b5011e530fc46de0

Generated at Thu Feb 08 03:47:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.