[CDRIVER-893] Support bypassDocumentValidation Created: 30/Sep/15  Updated: 02/Dec/15  Resolved: 20/Oct/15

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 1.2.0
Fix Version/s: 1.3.0-beta0

Type: New Feature Priority: Major - P3
Reporter: Rathi Gnanasekaran Assignee: Hannes Magnusson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CXX-690 Support bypassDocumentValidation Closed
is depended on by DRIVERS-250 Support bypassDocumentValidation Closed
is depended on by PHPC-443 Support bypassDocumentValidation opti... Closed
Related
related to CDRIVER-946 unimplemented method mongoc_bulk_oper... Closed
related to CDRIVER-957 w=0 with bypassDocumentValidation set... Closed
related to CDRIVER-971 Export mongoc_bulk_operation_set_bypa... Closed
related to CDRIVER-1009 Document mongoc_bulk_operation_set_by... Closed
related to CDRIVER-1012 Document aggregate and bypassDocument... Closed
is related to PHPC-495 Upgrade bundled libbson and libmongoc... Closed
is related to CDRIVER-945 mongoc_collection_find_and_modify_wit... Closed
Epic Link: MongoDB 3.2

 Description   

Added new mongoc_bulk_write_flags_t "flags" which replaces the existing "ordered" field in the mongoc_bulk_operation_t (private) struct.

This new struct contains various "bulk write" (e.g. "command write API") options.
Currently these options are:

  • ordered (bool)
  • bypass_document_validation (enum)

typedef enum
{
   MONGOC_BYPASS_DOCUMENT_VALIDATION_FALSE   = 0,
   MONGOC_BYPASS_DOCUMENT_VALIDATION_TRUE    = 1 << 0,
   MONGOC_BYPASS_DOCUMENT_VALIDATION_DEFAULT = 1 << 1,
} mongoc_write_bypass_document_validation_t;
 
struct _mongoc_bulk_write_flags_t
{
   bool ordered;
   mongoc_write_bypass_document_validation_t bypass_document_validation;
};

Added new functions:

mongoc_bulk_operation_set_bypass_document_validation (mongoc_bulk_operation_t *bulk, bool bypass);
mongoc_bulk_operation_set_flags (mongoc_bulk_write_operation_t *bulk, mongoc_bulk_write_flags_t flags);

When creating a new mongoc_bulk_write_flags_t it SHOULD be initialized using the MONGOC_BULK_WRITE_FLAGS_INIT macro like so:

mongoc_bulk_write_flags_t write_flags = MONGOC_BULK_WRITE_FLAGS_INIT;

Which initializes the flags as

ordered = true;
bypass_document_validation = server default;

When user explicitly passes bypass_document_validation it will be sent to the server – irregardless of its wire protocol version.



 Comments   
Comment by Githook User [ 02/Dec/15 ]

Author:

{u'username': u'derickr', u'name': u'Derick Rethans', u'email': u'github@derickrethans.nl'}

Message: Ordered flag has moved into 'flags' struct (CDRIVER-893)
Branch: master
https://github.com/mongodb/mongo-php-driver/commit/0a47eaa132422459cbcb1bf2b55dbef5ba2abdab

Comment by Derick Rethans [ 17/Nov/15 ]

Added the field name into the ticket, to be complete in its documentation.

Comment by Githook User [ 26/Oct/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-893: Initialize bypass_document_validation properly
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/ff176b1976ef060ed7f515bb3a76f2d4223cf9c9

Comment by Hannes Magnusson [ 20/Oct/15 ]

Resolving again – any additional command helpers that need to support bypassDocumentValidation should be their own tickets as they'd require fully new functions anyway (see CDRIVER-945 for example).

Comment by Kyle Suarez [ 16/Oct/15 ]

The C Driver must also support bypassDocumentValidation for the findAndModify command; specifically, mongoc_collection_find_and_modify().

Comment by Githook User [ 15/Oct/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-893: Ensure bypassDocumentValidation works for aggregate
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/cbac8daf891d3af54acc0d1a03e734734e89716f

Comment by Githook User [ 12/Oct/15 ]

Author:

{u'username': u'bjori', u'name': u'Hannes Magnusson', u'email': u'bjori@php.net'}

Message: CDRIVER-893: Support bypassDocumentValidation
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/c1712814a9b0ab882f5303f7e45a54ee3b5c93c7

Generated at Wed Feb 07 21:10:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.