~ubuntu-branches/ubuntu/trusty/mongodb/trusty-proposed

« back to all changes in this revision

Viewing changes to jstests/pull.js

  • Committer: Bazaar Package Importer
  • Author(s): Antonin Kral
  • Date: 2010-01-29 19:48:45 UTC
  • Revision ID: james.westby@ubuntu.com-20100129194845-8wbmkf626fwcavc9
Tags: upstream-1.3.1
ImportĀ upstreamĀ versionĀ 1.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
t = db.jstests_pull;
 
2
t.drop();
 
3
 
 
4
t.save( { a: [ 1, 2, 3 ] } );
 
5
t.update( {}, { $pull: { a: 2 } } );
 
6
t.update( {}, { $pull: { a: 6 } } );
 
7
assert.eq( [ 1, 3 ], t.findOne().a );
 
8
 
 
9
t.drop();
 
10
t.save( { a: [ 1, 2, 3 ] } );
 
11
t.update( {}, { $pull: { a: 2 } } );
 
12
t.update( {}, { $pull: { a: 2 } } );
 
13
assert.eq( [ 1, 3 ], t.findOne().a );
 
14
 
 
15
t.drop();
 
16
t.save( { a: [ 2 ] } );
 
17
t.update( {}, { $pull: { a: 2 } } );
 
18
t.update( {}, { $pull: { a: 6 } } );
 
19
assert.eq( [], t.findOne().a );