I
I
IDONTSUDO2019-12-27 13:09:49
MongoDB
IDONTSUDO, 2019-12-27 13:09:49

The right architectural solution?

And so I have a chat.
Its business logic consists of two collections in MongoDB, viz. Chanel
chat rooms : - User - Name - _id Messages in the rooms Message: - DialogId //and there are other fields The resulting dialog DialogId is the ObjectId of the Chanel document. And then the question arose that I need to delete all the Message collections in mongo if the dialog is deleted. But I don’t know how to do this correctly, since on one side the event loop will block for me. And on the other, conditional 10 thousand deletion operations in mongo.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hzzzzl, 2019-12-27
@IDONTSUDO

conditional 10 thousand deletion operations

why 10 thousand, db.messages.remove({ DialogId: room_id }) , I think mongo will optimize its behavior as it should

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question