mongodb: how can i get a array result
I have written a MongoDB query that looks like this: db.collection.aggregate([ { $group: { _id: null, categories: { $addToSet: "$category" } } }, { $project: { _id: 0, categories: 1 } } ]) but the result is: [ { "categories":…