0

I have MongoDB 4.x with collection, which have documents like this

image

how to make agregation, that return only bot-field, where _id is X? I've tried to use $project:

{ _id: 0, bot: {$filter: { input: '$clusters.bots', as: 'bot', cond: {$eq: ['$$bot._id', 'X']} }} }

  • So what code in Python have you tried so far? – miike3459 Dec 25 '18 at 20:21
  • @connectyourcharger i'll try thousands of variants, e.g. from core import modules bot = modules.Owner.objects.aggregate({ '$project': { 'bot': { '$eq': [ 'clusters.bots.id', 1 ] } } }) but I understand why it isn't valid :( – Yardal Gedal Dec 25 '18 at 21:51

0 Answers0