summaryrefslogtreecommitdiff
path: root/jstests/verify_update_mods.js
blob: 65f1f826bf5fccc7f2118eb09c50ac5fc64b2801 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Verify update mods exist
t = db.update_mods;
t.drop();

t.save({_id:1});
t.update({}, {$set:{a:1}})
assert.automsg( "!db.getLastError()" );
t.remove()

t.save({_id:1});
t.update({}, {$unset:{a:1}})
assert.automsg( "!db.getLastError()" );
t.remove()

t.save({_id:1});
t.update({}, {$inc:{a:1}})
assert.automsg( "!db.getLastError()" );
t.remove()

t.save({_id:1});
t.update({}, {$mul:{a:1}})
assert.automsg( "!db.getLastError()" );
t.remove()

t.save({_id:1});
t.update({}, {$push:{a:1}})
assert.automsg( "!db.getLastError()" );
t.remove()

t.save({_id:1});
t.update({}, {$pushAll:{a:[1]}})
assert.automsg( "!db.getLastError()" );
t.remove()

t.save({_id:1});
t.update({}, {$addToSet:{a:1}})
assert.automsg( "!db.getLastError()" );
t.remove()

t.save({_id:1});
t.update({}, {$pull:{a:1}})
assert.automsg( "!db.getLastError()" );
t.remove()

t.save({_id:1});
t.update({}, {$pop:{a:true}})
assert.automsg( "!db.getLastError()" );
t.remove()

t.save({_id:1});
t.update({}, {$rename:{a:"b"}})
assert.automsg( "!db.getLastError()" );
t.remove()

t.save({_id:1});
t.update({}, {$bit:{a:{and:NumberLong(1)}}})
assert.automsg( "!db.getLastError()" );
t.remove()

t.save({_id:1});
t.update({}, {$currentDate:{a:true}})
assert.automsg( "!db.getLastError()" );
t.remove()

t.save({_id:1});
t.update({}, {$max:{a:1}})
assert.automsg( "!db.getLastError()" );
t.remove()

t.save({_id:1});
t.update({}, {$min:{a:1}})
assert.automsg( "!db.getLastError()" );
t.remove()