mongoose-data-faker
Version:
Generate random fake data with your mongoose schema
30 lines (29 loc) • 406 B
JavaScript
db.collection.aggregate([
{
$project: {
staffId: 1,
category: 1,
createdAt: {
$dateToParts: {
date: "$createdAt",
},
},
},
},
{
$match: {
category: "trend",
createdAt: {
$regex: "2020-08-13",
},
},
},
{
$group: {
_id: null,
staffIds: {
$push: "$staffId",
},
},
},
]);