summaryrefslogtreecommitdiff
path: root/jstests/core/objid4.js
blob: 7513e07702967f9b1e94f910f343d4362a4d53d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19


o = new ObjectId();
assert(o.str);

a = new ObjectId(o.str);
assert.eq(o.str, a.str);
assert.eq(a.str, a.str.toString());

b = ObjectId(o.str);
assert.eq(o.str, b.str);
assert.eq(b.str, b.str.toString());

assert.throws(function(z) {
    return new ObjectId("a");
});
assert.throws(function(z) {
    return new ObjectId("12345678901234567890123z");
});