You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

22 lines
522 B

var insert = require('./insert')
insert('update multi', [{
hello: 'world1'
}, {
hello: 'world2'
}], function (db, t, done) {
db.a.update({}, {$set: {updated: true}}, {multi: true}, function (err, lastErrorObject) {
t.error(err)
t.equal(lastErrorObject.n, 2)
db.a.find(function (err, docs) {
t.error(err)
t.equal(docs.length, 2)
t.ok(docs[0].updated)
t.equal(docs[0].hello, 'world1')
t.ok(docs[1].updated)
t.equal(docs[1].hello, 'world2')
done()
})
})
})