We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have my documents created with createdAt and updatedAt fields from mongoose feature. I normally add date filters in this way:
createdAt
updatedAt
const filters = {}; if (from) filters.createdAt = { $gte: new Date(from).toISOString() }; if (to) filters.createdAt = { $lte: new Date(to).toISOString() }; if (from && to) { filters.createdAt = { $gte: new Date(from).toISOString(), $lte: new Date(to).toISOString(), }; }
For the aggregate I use:
const options = {}; const filtersPipeline = { $match: { ...filters, }, }; const aggregateQuery = MyModel.aggregate([ filtersPipeline, ]); MyModel.aggregatePaginate(aggregateQuery, { ...options, ...paginationOptions });
It should filter from-to date, but I got an empty array on results
I'm using Node v14 with:
{ "mongoose": "5.12.9", "mongoose-aggregate-paginate-v2": "1.0.42", "mongoose-paginate-v2": "1.3.14" }
This query it's working directly on Robo3t:
db.getCollection('mymodel').aggregate([ { $match: { createdAt: { $gte: ISODate('2022-09-16T09:45:17.000Z') }, }} ])
The text was updated successfully, but these errors were encountered:
I can't even match by _id
Sorry, something went wrong.
No branches or pull requests
I have my documents created with
createdAt
andupdatedAt
fields from mongoose feature. I normally add date filters in this way:For the aggregate I use:
It should filter from-to date, but I got an empty array on results
I'm using Node v14 with:
This query it's working directly on Robo3t:
The text was updated successfully, but these errors were encountered: