Skip to content

Commit b1c1c09

Browse files
stevestencildplewis
andcommitted
Add support to add hint to Parse.Query (parse-community#1054)
* added console.log * added _batchCount and _batchIndex properties * test batch index and count * added hint * added hint to ParseQuery * fixed failed tests * removed _batchIndex and _batchCount * added documentation and support for chaining * added documentation and tests * bump parse-server * fix tests Co-authored-by: Diamond Lewis <[email protected]>
1 parent 27a5ca0 commit b1c1c09

File tree

5 files changed

+563
-2348
lines changed

5 files changed

+563
-2348
lines changed

integration/test/ParseQueryTest.js

+13
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)