Search code examples
mongodbchangestream

how to use $lookup in mongodb change stream?


based on docs in mongoDB Change Stream Docs i can use only these operations for getting output of change stream:

  • $addFields
  • $match
  • $project
  • $replaceRoot
  • $replaceWith (Available starting in MongoDB 4.2)
  • $redact
  • $set (Available starting in MongoDB 4.2)
  • $unset (Available starting in MongoDB 4.2)

but I want to use $lookup op :(

Do you have any idea to achieve this?


Solution

  • The allowed operations are transformations on the change stream-produced documents. You are asking about joining other collections.

    If you want to join other collections, you need to issue those queries separately from the change stream.