I’m having trouble creating a document rule for matching the %%user.id
(which I believe is a string) to an ObjectId field (_id
).
The scenario is documents that have _id
s which are ObjectId conversions of the authenticated user_id
.
Here is the rule that does not work:
{
"_id": "%%user.id"
}
However, if I make an id
field that is a string of the same value and adjust the rule from _id
to id
, it works.
Should I just make my document _id’s strings, or is there a way to compare an ObjectId to a string in a rule?