kandi X-RAY | party-pooper Summary
kandi X-RAY | party-pooper Summary
party-pooper
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of party-pooper
party-pooper Key Features
party-pooper Examples and Code Snippets
Community Discussions
Trending Discussions on party-pooper
QUESTION
I have two collections, let's call them Cats
and Parties
, with the following schemas:
ANSWER
Answered 2017-Aug-25 at 11:49As stated, you want the "cats" so use the Cat
model and do the "left outer join" that is actually inherent to $lookup
, rather than asking for a "right outer join" from the opposing collection, since a "right outer join" is not possible with MongoDB at this time.
It's also far more practical as a "left join", because you want "cats" as your primary source of output. The only thing to consider when linking to "Party" is that each "Cat" is listed in an array, and therefore you get the whole document back. So all that needs to be done is in "post processing" after the $lookup
, you simply "filter" the array content for the matching entry of the current cat.
Fortunately we get good features with $arrayElemAt
and $indexOfArray
, that allow us to do that exact extraction:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install party-pooper
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page