I want to increment my database on each visit by using $.inc:{visit:1} of child 2 using mongooose+nodejs but as its the nested one its not working for me whereas if I'll put the visit count outside parent database then its working fine for me.
below is the data structure
{
_id:abfakjlhfkljahdfl,
parent:[{
_id:asdkjfhbaksdfha,
child1:[{
_id:agfagwbeabfkj,
visit:0,
sum:0
}],
child2:[{
_id:asdfnaknfkansfalnsfd,
visit:0,
sum:0
}],
child3:[{
_id:jalkdfjaljdfa,
visit:0,
sum:0
}]
}]
}
and make sure that I want to modify the visit count using parent Id using rest call findByIdAndUpdate.
thnx in advance
via Amit R Singh
No comments:
Post a Comment