Skip to content

Commit

Permalink
fix: 4.2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
coratgerl committed Oct 11, 2023
1 parent b5e5bc5 commit 7899daf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spec/ParseQuery.hint.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe_only_db('mongo')('Parse.Query hint', () => {
expect(explain.queryPlanner.winningPlan.queryPlan.inputStage.keyPattern).toEqual({ _id: 1 });
});

fit_only_mongodb_version('<4.4')('query aggregate with hint string', async () => {
it_only_mongodb_version('<4.4')('query aggregate with hint string', async () => {
const object = new TestObject({ foo: 'bar' });
await object.save();

Expand All @@ -87,15 +87,15 @@ describe_only_db('mongo')('Parse.Query hint', () => {
explain: true,
});
console.log(JSON.stringify(result[0], null, 2));
let { queryPlanner } = result[0];
let { queryPlanner } = result[0].stages[0].$cursor;
expect(queryPlanner.winningPlan.queryPlan.inputStage.stage).toBe('COLLSCAN');

result = await collection.aggregate([{ $group: { _id: '$foo' } }], {
hint: '_id_',
explain: true,
});
console.log(JSON.stringify(result[0], null, 2));
queryPlanner = result[0].queryPlanner;
queryPlanner = result[0].stages[0].$cursor.queryPlanner;
expect(queryPlanner.winningPlan.queryPlan.inputStage.stage).toBe('FETCH');
expect(queryPlanner.winningPlan.queryPlan.inputStage.inputStage.indexName).toBe('_id_');
});
Expand Down Expand Up @@ -180,14 +180,14 @@ describe_only_db('mongo')('Parse.Query hint', () => {
let result = await collection.aggregate([{ $group: { _id: '$foo' } }], {
explain: true,
});
let { queryPlanner } = result[0];
let { queryPlanner } = result[0].stages[0].$cursor;
expect(queryPlanner.winningPlan.queryPlan.inputStage.stage).toBe('COLLSCAN');

result = await collection.aggregate([{ $group: { _id: '$foo' } }], {
hint: { _id: 1 },
explain: true,
});
queryPlanner = result[0].queryPlanner;
queryPlanner = result[0].stages[0].$cursor.queryPlanner;
expect(queryPlanner.winningPlan.queryPlan.inputStage.stage).toBe('FETCH');
expect(queryPlanner.winningPlan.queryPlan.inputStage.inputStage.keyPattern).toEqual({ _id: 1 });
});
Expand Down Expand Up @@ -340,7 +340,7 @@ describe_only_db('mongo')('Parse.Query hint', () => {
},
});
response = await request(options);
queryPlanner = response.data.results[0].queryPlanner;
queryPlanner = response.data.results[0].stages[0].$cursor.queryPlanner;
expect(queryPlanner.winningPlan.queryPlan.inputStage.inputStage.keyPattern).toEqual({ _id: 1 });
});

Expand Down

0 comments on commit 7899daf

Please sign in to comment.