summaryrefslogtreecommitdiff
path: root/jstests/core/js1.js
blob: ecb81046e5366bf5d60fdcdd18e969199724d268 (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
// @tags: [
//   requires_non_retryable_writes,
//   # Uses $where operator
//   requires_scripting,
//   sbe_incompatible,
// ]

t = db.jstests_js1;
t.remove({});

t.save({z: 1});
t.save({z: 2});
assert(2 == t.find().length());
assert(2 == t.find({
                 $where: function() {
                     return 1;
                 }
             }).length());
assert(1 == t.find({
                 $where: function() {
                     return obj.z == 2;
                 }
             }).length());

assert(t.validate().valid);