Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

sample pull

  • Loading branch information...
commit e621ebc91ceb60e8143f5e2429e861a6b4d63a48 1 parent c90c179
Eliot authored April 08, 2010

Showing 1 changed file with 20 additions and 0 deletions. Show diff stats Hide diff stats

  1. 20  jstests/pullall2.js
20  jstests/pullall2.js
... ...
@@ -0,0 +1,20 @@
  1
+
  2
+t = db.pullall2
  3
+t.drop()
  4
+
  5
+o = { _id : 1 , a : [] }
  6
+for ( i=0; i<5; i++ )
  7
+    o.a.push( { x : i , y : i } )
  8
+
  9
+t.insert( o )
  10
+
  11
+assert.eq( o , t.findOne() , "A" );
  12
+
  13
+t.update( {} , { $pull : { a : { x : 3 } } } )
  14
+o.a = o.a.filter( function(z){ return z.x != 3 } )
  15
+assert.eq( o , t.findOne() , "B" );
  16
+
  17
+t.update( {} , { $pull : { a : { x : { $in : [ 1 , 4 ] } } } } );
  18
+o.a = o.a.filter( function(z){ return z.x != 1 } )
  19
+o.a = o.a.filter( function(z){ return z.x != 4 } )
  20
+assert.eq( o , t.findOne() , "C" );

0 notes on commit e621ebc

Please sign in to comment.
Something went wrong with that request. Please try again.