summaryrefslogtreecommitdiff
path: root/jstests/aggregation/sources/match/dotted_numeric_path.js
blob: e2e771479797c6a0f9775917d86a2bf71b1d4970 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
 * Tests that $match works correctly with dotted numeric path.
 *
 * @tags: [sbe_incompatible]
 */
(function() {
"use strict";

const collName = "dotted_numeric_path";
const coll = db.getCollection(collName);
coll.drop();

assert.commandWorked(coll.insert({"_id": 1, "quizzes": [{"score": 100}]}));
assert.commandWorked(coll.insert({"_id": 2, "quizzes": [{"score": 200}]}));

const res = coll.aggregate([{$match: {'quizzes.0.score': {$gt: 0}}}, {$count: 'count'}]).toArray();

assert.eq(res.length, 1);
assert.eq(res[0]['count'], 2);
}());