What happened to this request? I tried to run it on the mongodb server and received the error message: "exception: bad query: unknown top-level operator BadValue: $ gte". Can someone tell me what's wrong with him, please?
db.scores.aggregate([ { $match: { $or: [ { $gte: [ "$score", 30 ] }, { $lte: [ "$score", 60 ] } ] } }, { $group: { _id: "$gamer", games: { $sum: 1 } } } ])
sample data:
{ "_id" : "545665cef9c60c133d2bce72", "score" : 85, "gamer" : "Latern" } { "_id" : "545665cef9c60c133d2bce73", "score" : 10, "gamer" : "BADA55" } { "_id" : "545665cef9c60c133d2bce74", "score" : 62, "gamer" : "BADA55" } { "_id" : "545665cef9c60c133d2bce75", "score" : 78, "gamer" : "l00ser" } { "_id" : "545665cef9c60c133d2bce76", "score" : 4, "gamer" : "l00ser" } { "_id" : "545665cef9c60c133d2bce77", "score" : 55, "gamer" : "FunnyCat" }
source share