json: {
data:{
base:"Id",
},
res:{
message:"sddg"
}
}
I want to find if a particular record already exist on the basis of base unique attribute using Mongoose in MongoDB database, but unable to do so. My approach is:
model.findOne({data:{base:"Id"});
You should do it like this:
model.findOne("data.base": "Id")