Skip to content

Instantly share code, notes, and snippets.

@jaraco
Created July 6, 2018 21:28
Show Gist options
  • Save jaraco/2f20348678893e164efd74297a735c54 to your computer and use it in GitHub Desktop.
Save jaraco/2f20348678893e164efd74297a735c54 to your computer and use it in GitHub Desktop.
query = [{'$lookup': {
'from': 'tasks',
'let': {'target_id': '$ID'},
'pipeline': [
{
'$match': {
'$expr': {
'$eq': ['$TARGET_ID', '$$target_id'],
},
},
},
{
'$group': {
'_id': {'$max': '$HARVESTED'},
},
},
],
'as': 'last_harvested',
}}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment