I am trying to use the $lookup stage in my aggregation pipeline on an online archive database.
Let’s say I have 2 collections: person
and person_logs
. Docs in person_logs
are archived at 6 months, but person
is not archived. When connected to my online archive DB, both collections are visible and querable. However, if I try to aggregate person_logs
such that I’m also looking up the person
collection, the query just hangs. No errors are thrown, it just doesn’t ever return a result.
Same aggregation returns a normal result if connected to the live (not archive) DB.
Just FYI, here is the aggregation I’m using on the person_logs
collection:
[
{
$match: {date_created: {$gt: start_date, $lt: end_date}}
},
{
'$lookup': {
'from': 'persons',
'localField': 'person_id',
'foreignField': '_id',
'as': 'person'
}
},
{
$limit: 10
}
]
What could be the issue? Are the indexes inactivated somehow in the archive DB?