Problem with Realm Functions trying to run the findOneAndUpdate query

Hi

I’m trying to create a MongoDB Realm (Stitch) function, which tries to perform a findOneAndUpdate() query on one of my collections.

It works fine when I set the authentication level of the function to “Application Authentication”, and create a rule for that collection.

However, I do not want to have a rule for that collection, and hence tried to run the same function by setting the authentication level to “System”, and having NO RULES. But doing so results in an error, saying “mongo: no documents in result”. This only happens in findOneAndUpdate() and not in a simple findOne() query.

Is there a way to update a collection using a function with System level authentication, without a rule?

1 Like