Created
May 11, 2018 01:25
-
-
Save alfredhot/1e26c7f98b565d59c8a5b4bcb1ce6f43 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
db.influencers.aggregate([ | |
{ | |
$match: {ac: 1} | |
}, | |
{ | |
$project: {_id: 1} | |
}, | |
{ | |
$lookup: { | |
from: 'media', | |
let: {in_id: '$_id'}, | |
pipeline: [ | |
{ | |
$match: { | |
$expr: { | |
$eq: ['$i_id', '$$in_id'] | |
} | |
} | |
} | |
], | |
as: 'media' | |
} | |
}, | |
{ | |
$match: {media: {$ne: []}} | |
}, | |
{ | |
$unwind: '$media' | |
}, | |
{ | |
$limit: 20 | |
} | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment