there is a screenshot of a collection project and here is a key “acces” which data type is array of object.
I want to write a query if email already exist then update that object key “edit: true” if not exist then push new object.
Currently I’m doing this with the help of two diffrent query which is below
db.projects.findOneAndUpdate({ _id: ObjectId(“612dce352ff6127a9e45e86e”), “access.email”: { $eq: “rutulpanchal123@gmail.com” } }, {$pull: { “access”: { email: “rutulpanchal123@gmail.com”} }});
please help me as soon as possible