summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/ref.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/jstests/ref.js b/jstests/ref.js
new file mode 100644
index 00000000000..1c7201ace4e
--- /dev/null
+++ b/jstests/ref.js
@@ -0,0 +1,21 @@
+// 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 = other;
+db.things.save(x);
+
+assert( db.things.findOne().o.n == 1, "dbref broken 2" );
+
+other.n++;
+db.otherthings.save(other);
+//print( tojson( db.things.findOne() ) );
+print("ref.js: needs line uncommented after fixing bug:");
+//assert( db.things.findOne().o.n == 2, "dbrefs broken" );