Making a trigger so that when a document is updated , inserted , replaced the embeddings of it is updated/added

What is the operation type of the event running into this? (update, insert, or replace).

Update has different semantics for fullDocument depending on what version of MongoDB you are on. Before 6.0, if the document is updated and then deleted and then seen on the changestream, fullDocument will be empty. After 6.0 it is possible to guarantee the fullDocument is there.

See here for more details on that: https://www.mongodb.com/docs/manual/reference/method/db.collection.watch/

1 Like