I have many functions update with mongo
here is an example :
db.auto.update({'def.name':'AFFAIRES'},{$push:{
"covers":{$each: [{"a":'G06'},{"a":'G07'},{"a":'G03'},{"a":'G04'},{"a":'G07'},{"a":'G30'},{"a":'G34'},
{"cover":'G14'}]}}},{multi:true})
But,the problem, my collection may contain one of these variables "a", so i don't need to push it, and if it doesn't, i have to push it in the collection. So my question is how to tell mongoDB to verify before the push, is it possible?? My query may contain other variables to push also.