I want to insert a new item into an embedded array , but before that I need to make sure that that item does not exist already in the array : thats the collection
"Accounts":[
{
"Account_id" : 70,
"FirstName" : "name",
"LastName" : "bffff",
"Username" : "deee",
"Password" : "xyzqds@j",
"AccountType" : "admin",
"Created_at" : "01-01-2018",
"Rules" : {
"Goal" : 480,
"DoNotDisturbFrom" : "22",
"DoNotDisturbTo" : "8",
"Frequency" : "weekly"
}
},
{
"Account_id" : 52,
"FirstName" : "joe",
"LastName" : "Doe",
"Username" : "aajengui1",
"Password" : "abc@j",
"AccountType" : "user",
"Created_at" : "01-02-2018",
"Rules" : {
"Goal" : 260,
"DoNotDisturbFrom" : "10",
"DoNotDisturbTo" : "12",
"Frequency" : "monthly"
}
}
]
I want to append a new account into the array but it has to be unique so it's like verifying that the username / email does not exist already