Files
mongo/jstests/core/query/where/where3.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

26 lines
692 B
JavaScript

// @tags: [
// # Uses $where operator
// requires_scripting
// ]
let t = db.where3;
t.drop();
t.save({returned_date: 5});
t.save({returned_date: 6});
assert.eq(
1,
t
.find(function () {
return this.returned_date == 5;
})
.count(),
"A",
);
assert.eq(1, t.find({$where: "return this.returned_date == 5;"}).count(), "B");
assert.eq(1, t.find({$where: "this.returned_date == 5;"}).count(), "C");
assert.eq(1, t.find({$where: "(this.returned_date == 5);"}).count(), "D");
assert.eq(1, t.find({$where: "((this.returned_date == 5) && (5 == 5));"}).count(), "E");
assert.eq(1, t.find({$where: "x=this.returned_date;x == 5;"}).count(), "F");