summaryrefslogtreecommitdiff
path: root/jstests/core/insert1.js
blob: e4ce6a4e10eda6fd94b5411a126297ee3fb61745 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
t = db.insert1;
t.drop();

var o = {a:1};
t.insert(o);
var doc = t.findOne();
assert.eq(1, doc.a);
assert(doc._id != null, tojson(doc));

t.drop();
o = {a:2, _id:new ObjectId()};
var id = o._id;
t.insert(o);
doc = t.findOne();
assert.eq(2, doc.a);
assert.eq(id, doc._id);

t.drop();
o = {a:3, _id:"asdf"};
id = o._id;
t.insert(o);
doc = t.findOne();
assert.eq(3, doc.a);
assert.eq(id, doc._id);

t.drop();
o = {a:4, _id:null};
t.insert(o);
doc = t.findOne();
assert.eq(4, doc.a);
assert.eq(null, doc._id, tojson(doc));

var stats = db.runCommand({ collstats: "insert1" });
assert(stats.paddingFactor == 1.0);