@@ -355,6 +355,7 @@ define.classMethod('find', {callback: false, promise:false, returns: [Cursor]});
355
355
* @param {boolean } [options.j=false] Specify a journal write concern.
356
356
* @param {boolean } [options.serializeFunctions=false] Serialize functions on any object.
357
357
* @param {boolean } [options.forceServerObjectId=false] Force server to assign _id values instead of driver.
358
+ * @param {boolean } [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher.
358
359
* @param {Collection~insertWriteOpCallback } [callback] The command result callback
359
360
* @return {Promise } returns Promise if no callback passed
360
361
*/
@@ -511,6 +512,7 @@ define.classMethod('insertMany', {callback: true, promise:true});
511
512
* @param {boolean } [options.j=false] Specify a journal write concern.
512
513
* @param {boolean } [options.serializeFunctions=false] Serialize functions on any object.
513
514
* @param {boolean } [options.ordered=true] Execute write operation in ordered or unordered fashion.
515
+ * @param {boolean } [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher.
514
516
* @param {Collection~bulkWriteOpCallback } [callback] The command result callback
515
517
* @return {Promise } returns Promise if no callback passed
516
518
*/
@@ -680,6 +682,7 @@ define.classMethod('bulkWrite', {callback: true, promise:true});
680
682
* @param {boolean } [options.j=false] Specify a journal write concern.
681
683
* @param {boolean } [options.serializeFunctions=false] Serialize functions on any object.
682
684
* @param {boolean } [options.forceServerObjectId=false] Force server to assign _id values instead of driver.
685
+ * @param {boolean } [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher.
683
686
* @param {Collection~insertWriteOpCallback } [callback] The command result callback
684
687
* @return {Promise } returns Promise if no callback passed
685
688
* @deprecated Use insertOne, insertMany or bulkWrite
@@ -730,6 +733,7 @@ define.classMethod('insert', {callback: true, promise:true});
730
733
* @param {(number|string) } [options.w=null] The write concern.
731
734
* @param {number } [options.wtimeout=null] The write concern timeout.
732
735
* @param {boolean } [options.j=false] Specify a journal write concern.
736
+ * @param {boolean } [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher.
733
737
* @param {Collection~updateWriteOpCallback } [callback] The command result callback
734
738
* @return {Promise } returns Promise if no callback passed
735
739
*/
@@ -778,6 +782,7 @@ define.classMethod('updateOne', {callback: true, promise:true});
778
782
* @param {(number|string) } [options.w=null] The write concern.
779
783
* @param {number } [options.wtimeout=null] The write concern timeout.
780
784
* @param {boolean } [options.j=false] Specify a journal write concern.
785
+ * @param {boolean } [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher.
781
786
* @param {Collection~updateWriteOpCallback } [callback] The command result callback
782
787
* @return {Promise } returns Promise if no callback passed
783
788
*/
@@ -910,6 +915,7 @@ var updateDocuments = function(self, selector, document, options, callback) {
910
915
* @param {boolean } [options.j=false] Specify a journal write concern.
911
916
* @param {boolean } [options.upsert=false] Update operation is an upsert.
912
917
* @param {boolean } [options.multi=false] Update one/all documents with operation.
918
+ * @param {boolean } [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher.
913
919
* @param {Collection~writeOpCallback } [callback] The command result callback
914
920
* @throws {MongoError }
915
921
* @return {Promise } returns Promise if no callback passed
@@ -955,6 +961,7 @@ define.classMethod('update', {callback: true, promise:true});
955
961
* @param {(number|string) } [options.w=null] The write concern.
956
962
* @param {number } [options.wtimeout=null] The write concern timeout.
957
963
* @param {boolean } [options.j=false] Specify a journal write concern.
964
+ * @param {boolean } [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher.
958
965
* @param {Collection~deleteWriteOpCallback } [callback] The command result callback
959
966
* @return {Promise } returns Promise if no callback passed
960
967
*/
@@ -2194,6 +2201,11 @@ var findAndModify = function(self, query, sort, doc, options, callback) {
2194
2201
queryObject . writeConcern = finalOptions . writeConcern ;
2195
2202
}
2196
2203
2204
+ // Have we specified bypassDocumentValidation
2205
+ if ( typeof finalOptions . bypassDocumentValidation == 'boolean' ) {
2206
+ queryObject . bypassDocumentValidation = finalOptions . bypassDocumentValidation ;
2207
+ }
2208
+
2197
2209
// Execute the command
2198
2210
self . s . db . command ( queryObject
2199
2211
, options , function ( err , result ) {
@@ -2257,6 +2269,7 @@ define.classMethod('findAndRemove', {callback: true, promise:true});
2257
2269
* @param {boolean } [options.explain=false] Explain returns the aggregation execution plan (requires mongodb 2.6 >).
2258
2270
* @param {boolean } [options.allowDiskUse=false] allowDiskUse lets the server know if it can use disk to store temporary results for the aggregation (requires mongodb 2.6 >).
2259
2271
* @param {number } [options.maxTimeMS=null] maxTimeMS specifies a cumulative time limit in milliseconds for processing operations on the cursor. MongoDB interrupts the operation at the earliest following interrupt point.
2272
+ * @param {boolean } [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher.
2260
2273
* @param {Collection~resultCallback } callback The command result callback
2261
2274
* @return {(null|AggregationCursor) }
2262
2275
*/
@@ -2296,6 +2309,12 @@ Collection.prototype.aggregate = function(pipeline, options, callback) {
2296
2309
2297
2310
// Build the command
2298
2311
var command = { aggregate : this . s . name , pipeline : pipeline } ;
2312
+
2313
+ // If we have bypassDocumentValidation set
2314
+ if ( typeof options . bypassDocumentValidation == 'boolean' ) {
2315
+ command . bypassDocumentValidation = options . bypassDocumentValidation ;
2316
+ }
2317
+
2299
2318
// If we have allowDiskUse defined
2300
2319
if ( options . allowDiskUse ) command . allowDiskUse = options . allowDiskUse ;
2301
2320
if ( typeof options . maxTimeMS == 'number' ) command . maxTimeMS = options . maxTimeMS ;
@@ -2764,6 +2783,7 @@ function processScope (scope) {
2764
2783
* @param {object } [options.scope=null] Can pass in variables that can be access from map/reduce/finalize.
2765
2784
* @param {boolean } [options.jsMode=false] It is possible to make the execution stay in JS. Provided in MongoDB > 2.0.X.
2766
2785
* @param {boolean } [options.verbose=false] Provide statistics on job execution time.
2786
+ * @param {boolean } [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher.
2767
2787
* @param {Collection~resultCallback } [callback] The command result callback
2768
2788
* @throws {MongoError }
2769
2789
* @return {Promise } returns Promise if no callback passed
@@ -2826,6 +2846,11 @@ var mapReduce = function(self, map, reduce, options, callback) {
2826
2846
options . readPreference = 'primary' ;
2827
2847
}
2828
2848
2849
+ // Is bypassDocumentValidation specified
2850
+ if ( typeof options . bypassDocumentValidation == 'boolean' ) {
2851
+ mapCommandHash . bypassDocumentValidation = options . bypassDocumentValidation ;
2852
+ }
2853
+
2829
2854
// Execute command
2830
2855
self . s . db . command ( mapCommandHash , { readPreference :options . readPreference } , function ( err , result ) {
2831
2856
if ( err ) return handleCallback ( callback , err ) ;
0 commit comments