Files
mongo/jstests/core/objid1.js

19 lines
313 B
JavaScript
Raw Normal View History

2009-01-26 23:28:26 -05:00
t = db.objid1;
t.drop();
b = new ObjectId();
assert(b.str, "A");
2009-01-26 23:28:26 -05:00
a = new ObjectId(b.str);
assert.eq(a.str, b.str, "B");
2009-01-26 23:28:26 -05:00
t.save({a: a});
assert(t.findOne().a.isObjectId, "C");
assert.eq(a.str, t.findOne().a.str, "D");
2009-01-26 23:28:26 -05:00
x = {
a: new ObjectId()
};
eval(" y = " + tojson(x));
assert.eq(x.a.str, y.a.str, "E");