summaryrefslogtreecommitdiff
path: root/jstests/pull_remove1.js
blob: 379f3f2832b805a6bf03a267f61b1ee1a5a35b89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14

t = db.pull_remove1
t.drop()

o = { _id : 1 , a : [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ] }
t.insert( o )

assert.eq( o , t.findOne() , "A1" )

o.a = o.a.filter( function(z){ return z >= 6; } )
t.update( {} , { $pull : { a : { $lt : 6 } } } )

assert.eq( o.a , t.findOne().a , "A2" )