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”), “”: { $eq: “” } }, {$pull: { “access”: { email: “”} }});

please help me as soon as possible

second query is here

db.projects.findOneAndUpdate({ _id: 612dce352ff6127a9e45e86e, “”: { $ne: “" } }, { $push: { “access”: {email: “”, 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