News for hackers. Stuff that matters.
Re:Was MongoDB Ever the Right Choice? by squeaky-clean on Wednesday March 27, 2019 @09:54AM (#19500794)

    db.formEvent.aggregate([
        { $match: { createdAt: {$gte: ISODate("whenever")}}},
        { $group: { _id: "$custId", userAgents: { $addToSet: "$metadata.userAgent" } } },
        { $sort: { createdAt: -1 } }
    ])
Something like this? I'm not sure why this couldn't be an optimized query in mongo, but I'm also not sure why a query like this one needs to be optimized? This would run fast enough without needing indexes, and really fast with an index on a couple fields, but is a query like this run so frequently you need to have it be extremely optimized?

There are no comments on this comment yet.