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

t = db.find_and_modify_server7660;
t.drop();

a = t.findAndModify({
    query : { foo : 'bar' },
    update : { $set : { bob : 'john' } },
    sort: { foo : 1},
    upsert: true,
    new : true
});

b = t.findOne();
assert.eq( a, b );
assert.eq( "bar", a.foo );
assert.eq( "john", a.bob )