Files
mongo/jstests/core/query/js/js1.js
Zac 591928c619 SERVER-108478 JS formatted by prettier and remove clang-format (#39656)
GitOrigin-RevId: 6c8f6aded47f260aa4f7c231b17dae3302cb1e04
2025-08-21 17:27:09 +00:00

36 lines
646 B
JavaScript

// @tags: [
// requires_non_retryable_writes,
// # Uses $where operator
// requires_scripting,
// ]
let 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 () {
// eslint-disable-next-line
return obj.z == 2;
},
})
.length(),
);
assert(t.validate().valid);