summaryrefslogtreecommitdiff
path: root/jstests/ref3.js
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-10-02 17:07:07 -0400
committerEliot Horowitz <eliot@10gen.com>2009-10-02 17:07:07 -0400
commitcc2c5c491100d3c8782a1c95b6fc362db91158c5 (patch)
treedd7fa8efde833e170c387b77c82420339b0c2128 /jstests/ref3.js
parenteaf0c845bccc01d61b7971b8c3b507fc7a175d38 (diff)
downloadmongo-cc2c5c491100d3c8782a1c95b6fc362db91158c5.tar.gz
add new style DBRef to js SERVER-243
Diffstat (limited to 'jstests/ref3.js')
-rw-r--r--jstests/ref3.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/jstests/ref3.js b/jstests/ref3.js
new file mode 100644
index 00000000000..77d6038f182
--- /dev/null
+++ b/jstests/ref3.js
@@ -0,0 +1,19 @@
+// to run:
+// ./mongo jstests/ref.js
+
+db.otherthings.drop();
+db.things.drop();
+
+var other = { s : "other thing", n : 1};
+db.otherthings.save(other);
+
+db.things.save( { name : "abc" } );
+x = db.things.findOne();
+x.o = new DBRef( "otherthings" , other._id );
+db.things.save(x);
+
+assert( db.things.findOne().o.fetch().n == 1, "dbref broken 2" );
+
+other.n++;
+db.otherthings.save(other);
+assert( db.things.findOne().o.fetch().n == 2, "dbrefs broken" );