I have two collections The structure of collection A is
{
id:
product:
}
The structure of collection B is
{
id:
product:
status:
}
I want to update collection B like if a product exists in collection A, then it will set status 1 to the corresponding document of collection B.
The SQL syntax would be like
UPDATE B SET B.STATUS = 1 WHERE B.PRODUCT IN (SELECT PRODUCT FROM A);
I just need to do the same in MongoDB. Thanks in advance.