I am new in MongoDB and using version 3.0.11. I have created a field shared_group
which is an ObjectId and sometimes this ID could be null.
shared_group:{
type: Schema.Types.ObjectId,ref:"Group",require:false
},
and in API request I am sending
{
"data":{
"shared_group":"null"
}
}
Error - CastError: Cast to ObjectId failed for value "" at path "shared_group"
if I send shared_group:[ID]
then it works fine.
Any suggestion is highly appreciated. Thanks in advance.