scottwrobinson / camo

A class-based ES6 ODM for Mongo-like databases.
556 stars 80 forks source link

Double request needed to delete operation #119

Closed muhammederenozyurur closed 6 years ago

muhammederenozyurur commented 6 years ago

I can't delete a row with the findOneAndDelete or other delete functions. On my first attempt to delete the user from the user list camo adds a row to the database like that one :

{"name":"Muhammed Eren Ozyurur","username":"mo","room":"mo","password":"123","access_permission":true,"_id":"yLZgB6N6foRR79R2"}
{"$$indexCreated":{"fieldName":"username","unique":true,"sparse":false}}
{"$$indexCreated":{"fieldName":"room","unique":true,"sparse":false}}
{"$$deleted":true,"_id":"yLZgB6N6foRR79R2"}

On my second attempt to delete the user it really deletes it from the file and returns me the valid res.send value. Also, if I do another operation with the document it really deletes it from the file, too. But of course without a res.send value.