I feel like my question is going to have a really simple answer but here it goes.
I have a MongoDB structure like
{
...
a: [array elements],
b: [array elements],
c: [array elements],
...
}
I'm using Mongoose and currently I have 3 find distinct calls going out.
Model.find().distinct('a', ...)
Model.find().distinct('b', ...)
Model.find().distinct('c', ...)
This does give me what I want, but I would like to get the information in one call. I thought I might be able to use aggregate to do this and get a new Object that looks like
{
a: [distinct array elements],
b: [distinct array elements],
c: [distinct array elements]
}
What would be the fastest way to get this from MongoDB in one shot?