Created
April 4, 2017 09:57
-
-
Save bhargavkonkathi/47cb72a3f958fac135cb1f736384a64e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"waitedMS" : NumberLong(0), | |
"result" : [ | |
{ | |
"_id" : ObjectId("58b80a5f922a9656b78e86a7"), | |
"email" : "[email protected]", | |
"access" : [ | |
{ | |
"roleId" : ObjectId("58e35fea31d05f0e95e0c8fd"), | |
"name" : "brgv k", | |
"role" : "crews", | |
"path" : "", | |
"photo" : "" | |
}, | |
{ | |
"role" : "boats" | |
}, | |
{ | |
"name" : null, | |
"role" : "crews" | |
}, | |
{ | |
"role" : "accounts" | |
}, | |
{ | |
"roleId" : ObjectId("580df78d3543ce1d905ffb11"), | |
"name" : "Nightquest", | |
"role" : "accounts" | |
}, | |
{ | |
"roleId" : ObjectId("58b80a62922a9656b78e86a8"), | |
"name" : "brgvk", | |
"role" : "boats", | |
"path" : "", | |
"photo" : "" | |
}, | |
{ | |
"roleId" : ObjectId("563160bb671f0c130e6f09b5"), | |
"name" : "Ocean Racing Club Victoria1", | |
"role" : "accounts" | |
} | |
] | |
} | |
], | |
"ok" : 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Querying multiple lookups and aggregating data into single array based on condition in mongodb
I have four collections in mongdob users, accounts, boats, crews; all with different data structures
Here are the samples
Right now I am using the following aggregation pipeline and I am able to query the data
I want to remove the objects that do not have a roleId associated with them.