@@ -513,9 +513,7 @@ Collection.prototype.insertMany = function(docs, options, callback) {
513
513
514
514
// Return a Promise
515
515
return new this . s . promiseLibrary ( function ( resolve , reject ) {
516
- // console.log("########## insertMany 0")
517
516
bulkWrite ( self , operations , options , function ( err , r ) {
518
- // console.log("########## insertMany 1")
519
517
if ( err ) return reject ( err ) ;
520
518
resolve ( mapInserManyResults ( docs , r ) ) ;
521
519
} ) ;
@@ -2478,8 +2476,10 @@ var findAndRemove = function(self, query, sort, options, callback) {
2478
2476
define . classMethod ( 'findAndRemove' , { callback : true , promise :true } ) ;
2479
2477
2480
2478
function decorateWithWriteConcern ( command , self , options ) {
2479
+ // Do we support collation 3.4 and higher
2480
+ var capabilities = self . s . topology . capabilities ( ) ;
2481
2481
// Do we support write concerns 3.4 and higher
2482
- if ( self . s . topology . capabilities ( ) . commandsTakeWriteConcern ) {
2482
+ if ( capabilities && capabilities . commandsTakeWriteConcern ) {
2483
2483
// Get the write concern settings
2484
2484
var finalOptions = writeConcern ( shallowClone ( options ) , self . s . db , self , options ) ;
2485
2485
// Add the write concern to the command
@@ -2491,7 +2491,9 @@ function decorateWithWriteConcern(command, self, options) {
2491
2491
2492
2492
function decorateWithCollation ( command , self , options ) {
2493
2493
// Do we support collation 3.4 and higher
2494
- if ( self . s . topology . capabilities ( ) . commandsTakeCollation ) {
2494
+ var capabilities = self . s . topology . capabilities ( ) ;
2495
+ // Do we support write concerns 3.4 and higher
2496
+ if ( capabilities && capabilities . commandsTakeCollation ) {
2495
2497
if ( options . collation && typeof options . collation == 'object' ) {
2496
2498
command . collation = options . collation ;
2497
2499
} else if ( self . s . collation && typeof self . s . collation == 'object' ) {
0 commit comments