File tree 1 file changed +44
-1
lines changed 1 file changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -360,4 +360,47 @@ vows.describe('mongodb').addBatch({
360
360
}
361
361
}
362
362
}
363
- } ) . export ( module ) ;
363
+ } )
364
+ . addBatch ( {
365
+ 'updateMany' : {
366
+ topic : function ( ) {
367
+ db . createCollection ( 'event' , function ( err , collection ) {
368
+ if ( err ) {
369
+ return this . callback ( err ) ;
370
+ }
371
+ db . insert ( 'event' , { id : 2 , title : 'title' } , function ( err ) {
372
+ if ( err ) {
373
+ return this . callback ( err ) ;
374
+ }
375
+
376
+ var command = 'updateMany' ;
377
+ var renameFieldOptions = {
378
+ query : { } ,
379
+ update : {
380
+ $rename : {
381
+ title : 'titleUpdated'
382
+ }
383
+ } ,
384
+ options : { }
385
+ } ;
386
+
387
+ db . _run ( command , 'event' , renameFieldOptions , function ( err ) {
388
+ if ( err ) {
389
+ return this . callback ( err ) ;
390
+ }
391
+ db . _find ( 'event' , { titleUpdated : 'title' } , this . callback ) ;
392
+ } . bind ( this ) ) ;
393
+ } . bind ( this ) ) ;
394
+ } . bind ( this ) ) ;
395
+ } ,
396
+
397
+ teardown : function ( ) {
398
+ db . dropCollection ( 'event' , this . callback ) ;
399
+ } ,
400
+
401
+ 'with renamed row' : function ( err , data ) {
402
+ assert . equal ( data . length , 1 ) ;
403
+ }
404
+ }
405
+ } )
406
+ . export ( module ) ;
You can’t perform that action at this time.
0 commit comments