I have two schemas as below
Schema1
{
"_id": ObjectId,
"isSet": Boolean,
}
Schema2
{
"_id":ObjectId,
"name": "String",
"schema1Id": {type: ObjectId, "ref": "Schema1"}
}
Now I want to query schema2 for all documents with name and isSet with value false.
How can I do this using mongo. I don't want to use $lookup as it doesn't support in sharding.
If I keep isSet in Schema2 as well, I need to update both schemas when I update the value of isSet, as it will be costly operation, I don't want to do that.
Is there a better solution to achieve this?