Skip to content

Commit 6b51be9

Browse files
authored
Merge pull request #4 from parse-community/master
Add support to add hint to Parse.Query (parse-community#1054)
2 parents 27a5ca0 + b1c1c09 commit 6b51be9

File tree

5 files changed

+563
-2348
lines changed

5 files changed

+563
-2348
lines changed

integration/test/ParseQueryTest.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,4 +2011,17 @@ describe('Parse Query', () => {
20112011
});
20122012
query.cancel();
20132013
});
2014+
2015+
it('can query with hint', async () => {
2016+
const obj1 = new TestObject({ number: 1 });
2017+
const obj2 = new TestObject({ number: 2 });
2018+
const obj3 = new TestObject({ number: 3 });
2019+
await Parse.Object.saveAll([obj1, obj2, obj3]);
2020+
2021+
const query = new Parse.Query(TestObject);
2022+
query.hint('_id_');
2023+
query.explain();
2024+
const explain = await query.find();
2025+
assert.equal(explain.queryPlanner.winningPlan.inputStage.inputStage.indexName, '_id_');
2026+
});
20142027
});

0 commit comments

Comments
 (0)