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

« back to all changes in this revision

Viewing changes to jstests/ref3.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
// to run: 
 
2
//   ./mongo jstests/ref.js
 
3
 
 
4
db.otherthings.drop();
 
5
db.things.drop();
 
6
 
 
7
var other = { s : "other thing", n : 1};
 
8
db.otherthings.save(other);
 
9
 
 
10
db.things.save( { name : "abc" } );
 
11
x = db.things.findOne();
 
12
x.o = new DBRef( "otherthings" , other._id );
 
13
db.things.save(x);
 
14
 
 
15
assert( db.things.findOne().o.fetch().n == 1, "dbref broken 2" );
 
16
 
 
17
other.n++;
 
18
db.otherthings.save(other);
 
19
assert( db.things.findOne().o.fetch().n == 2, "dbrefs broken" );