How to check if object is exist then update otherwise push a new object in to that

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

second query is here

db.projects.findOneAndUpdate({ _id: 612dce352ff6127a9e45e86e, “access.email”: { $ne: “rutulpanchal123@gmail.com" } }, { $push: { “access”: {email: “rutulpanchal123@gmail.com”, edit: true }});

with the help of first query I checked it out that if email exist then pull from array
and with the help of econd query I pushed new object into the array