diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-03-01 10:33:52 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-03-01 10:33:52 -0500 |
commit | 45d3cfbfcf6176d70f7ea4be7b136eb1213f0c4a (patch) | |
tree | d03d8f393882ddb4f06a3d57b38887114517d5ba /jstests | |
parent | c3ae414ff8a29579c74190c8b7939833487e5d0b (diff) | |
download | mongo-45d3cfbfcf6176d70f7ea4be7b136eb1213f0c4a.tar.gz |
.insert can't have a return
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/insert1.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/jstests/insert1.js b/jstests/insert1.js index a6ce4093cf8..834fed56a1e 100644 --- a/jstests/insert1.js +++ b/jstests/insert1.js @@ -2,7 +2,8 @@ t = db.insert1; t.drop(); o = {a:1}; -id = t.insert(o); +t.insert(o); +id = t.lastID assert.eq(o, {a:1}, "input unchanged 1"); assert.eq(typeof(id), "object", "1"); assert.eq(id.constructor, ObjectId, "1"); @@ -11,7 +12,8 @@ assert.eq(t.findOne({a:1})._id, id , "find by val 1"); o = {a:2, _id:new ObjectId()}; id1 = o._id -id2 = t.insert(o); +t.insert(o); +id2 = t.lastID assert.eq(id1, id2, "ids match 2"); assert.eq(o, {a:2, _id:id1}, "input unchanged 2"); assert.eq(typeof(id2), "object", "2"); @@ -21,7 +23,8 @@ assert.eq(t.findOne({a:2})._id, id1 , "find by val 2"); o = {a:3, _id:"asdf"}; id1 = o._id -id2 = t.insert(o); +t.insert(o); +id2 = t.lastID assert.eq(id1, id2, "ids match 3"); assert.eq(o, {a:3, _id:id1}, "input unchanged 3"); assert.eq(typeof(id2), "string", "3"); @@ -30,7 +33,8 @@ assert.eq(t.findOne({a:3})._id, id1 , "find by val 3"); o = {a:4, _id:null}; id1 = o._id -id2 = t.insert(o); +t.insert(o); +id2 = t.lastID assert.eq(id1, id2, "ids match 4"); assert.eq(o, {a:4, _id:id1}, "input unchanged 4"); assert.eq(t.findOne({_id:id1}).a, 4, "find by id 4"); |