recursively traverse the pipeline and convert any Pointer or Date columns
But it can only recognize existing fields defined in the collection schema. If we create a new Data field in project stage, it can not recognize it and the query won't work.
Examples: any match on startTime will work, but not on endTime, which is generated in project stage.
var pipeline = [ {match: {_p_user: "_User$"+userId},}, { project: { _p_user: 1, startTime: 1, "endTime": {$add: ["$startTime", {$multiply: ["$duration",60000]}]} } },// startTime can be recognized as Date() type, thus the query will work {match: {"startTime": {$gt: new Date()}}},// endTime can not be recognized as Date type, any query on endTime will fail // {match: {"endTime": {$gt: new Date()}}}, {limit: 10}, ];
Sourcefile: https://github.com/parse-community/parse-server/blob/master/src/Adapters/Storage/Mongo/MongoStorageAdapter.js
Function name: _parseAggregateArgs()
The purpose of the function is to
But it can only recognize existing fields defined in the collection schema. If we create a new Data field in project stage, it can not recognize it and the query won't work.
Examples: any match on startTime will work, but not on endTime, which is generated in project stage.
var pipeline = [
{match: {_p_user: "_User$"+userId},},
{
project: {
_p_user: 1,
startTime: 1,
"endTime": {$add: ["$startTime", {$multiply: ["$duration",60000]}]}
}
},
// startTime can be recognized as Date() type, thus the query will work
{match: {"startTime": {$gt: new Date()}}},
// endTime can not be recognized as Date type, any query on endTime will fail
// {match: {"endTime": {$gt: new Date()}}},
{limit: 10},
];