fix: query aggregation pipeline cannot handle value of type Date when directAccess: true (#8167)

This commit is contained in:
dblythy
2022-09-18 00:19:28 +10:00
committed by GitHub
parent cec3071170
commit e424137406
2 changed files with 20 additions and 0 deletions

View File

@@ -666,6 +666,23 @@ describe('Parse.Query Aggregate testing', () => {
});
});
it('should aggregate with Date object (directAccess)', async () => {
const rest = require('../lib/rest');
const auth = require('../lib/Auth');
const TestObject = Parse.Object.extend('TestObject');
const date = new Date();
await new TestObject({ date: date }).save(null, { useMasterKey: true });
const config = Config.get(Parse.applicationId);
const resp = await rest.find(
config,
auth.master(config),
'TestObject',
{},
{ pipeline: [{ $match: { date: { $lte: new Date() } } }] }
);
expect(resp.results.length).toBe(1);
});
it('match comparison query', done => {
const options = Object.assign({}, masterKeyOptions, {
body: {