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
db.collection.distinctDate
Imagine you have a collection with a timestamp property, and you want to know quickly what dates are those object from.
I leave a piece of code to start here:
db.collection.aggregate([ { "$project": { "year": { "$year": "$created" }, "month": { "$month": "$created" }, "day": { "$dayOfMonth": "$created" } }}, { "$group": { "_id": null, "distinctDate": { "$addToSet": { "year": "$year", "month": "$month", "day": "$day" }} }} ])
It could also be possible to add a distinctAndCountDate shortcut, it would be extremely useful for some scenarios.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Imagine you have a collection with a timestamp property, and you want to know quickly what dates are those object from.
I leave a piece of code to start here:
It could also be possible to add a distinctAndCountDate shortcut, it would be extremely useful for some scenarios.
The text was updated successfully, but these errors were encountered: