0

Hello I am using mongoDB 3.4.0

and the query is:

db.collection.aggregate([
                {"$project":{"_id": ObjectId("595c911093e2359c3af3fefb"),
                            "GROUP_count": { "$size": "$GROUPS" },
                            "SYSTEM_count": { "$size": "$IDUS" }
                            }
                         }])

But i an getting error "OperationFailure: exception: invalid operator '$size'"

Sujit
  • 1
  • If that's the error then it not MongoDB 3.4. In fact it would be pretty ancient. Don't look at what the shell says on startup, but rather do `db.version()` from within the shell to report the actual "server" version. Otherwise the actual error would be [The argument to $size must be an Array, but was of type: EOO](https://stackoverflow.com/a/24201302/2313887) which is different, with a completely different reason. – Neil Lunn Jul 07 '17 at 06:13
  • @felix I cannot see how that is relevant beyond marking as a duplicate to the link just given. If the error really is `invalid operator '$size'"` then it's MongoDB 2.4 or lower. Else, the error error points to the duplicate. No? – Neil Lunn Jul 07 '17 at 06:15

0 Answers0