2 / 10
Mar 25

Hello,

Since today we encounter a strange issue regarding an insertOne into the MongoDB Atlas backend. We have adjusted nothing, no changes to rules, schema or functions but suddenly the inserts are failing.

The wild thing is that the error is not even consistent:

role “Customer” in “main.customerOrder” does not have insert permission for document with _id: ObjectID(“67e2c57fcaa0801c71a09ce2”): terms: unspecified fields in document: [paymentTermConditions note paymentTerms deliveryTerms]

role “Customer” in “main.customerOrder” does not have insert permission for document with _id: ObjectID(“67e2c577caa0801c71a09ce0”): destination: unspecified fields in document: [_id name street city contactPerson houseNo type postalCode country]`

role “Customer” in “main.customerOrder” does not have insert permission for document with _id: ObjectID(“67e2c886caa0801c71a09ce4”): contractInformation: unspecified fields in document: [contractNo _id]

The field that errors that randomly changes. Since we could not find any changes on our side we are afraid that Mongo itself changed something that led to this issues?

Hi @Daniel_Bebber1 ,

Given the section of the Forum you posted this request in, I assume the MongoDB collections you’re trying to insert in are under Device Sync. That means a number of rules apply, and brings the question, how are you inserting documents? The issue seems to be that fields marked as required in your schema are missing, that shouldn’t be possible if you’re using the SDKs, but is difficult to diagnose without looking at your setup.

If you have a Support contract, opening a case would be the best way forward, as we could look at the whole Project and application (that is obviously not advisable to share in a public forum).

Hi!
We are not using device sync.
We are using the insertOne function of the realm-web npm package inside a React Application.

There is nothing missing inside the schema. The exact fields that are mentioned inside the logs are there AND got the correct type. The exact same calls worked yesterday, nothing was changed on our side. We are just suddenly receiving errors.

Hi @Daniel_Bebber1 ,

Again, we cannot diagnose the issue on this information, a look at your app is needed, to understand what’s going on. There isn’t any known outage that would cause malfunction at this time, and the last change to the backend was last week (and it doesn’t seem to have affected that area).

Okay, I understand. But this “unspecified fields in document” error is completely new.
When googling you find 0 matches. I feels like there was something new introduced here that destroys functional code.

Like the change some weeks ago where suddenly github deploys of applications with config.json that contained a function name multiple times were no longer working.

Hi @Daniel_Bebber1 ,

I’ve been looking into old cases, and the error itself has been there for many years: unfortunately, old cases don’t help understand the current scenario you’re in, and we haven’t heard of similar issues recently from anyone else.

I’m afraid that we can’t help you without more information, sorry!

Okay I understand…

Just as an update - I adjusted the worflow to perform the insert one inside a function that is run as system.

The insert was successful and the inserted document is valid to the schema. So we will use this as a workaround now.

Hi @Daniel_Bebber1 ,

This reinforces the impression that it may be a matter of Rules in the application (as a System user overrides all of them), it may be worth to double-check those.

Community member here: How is your experience with real-web? Last I checked the latency was quite long as it used the DATA API under the hood… Im sure you are also aware that its all being deprecated this year and real-web will no longer work and or supported (as per the notice and forums)

@Daniel_Bebber1 Community member here: How is your experience with realm-web? Last I checked the latency was quite long as it used the DATA API under the hood… I’m sure you are also aware that its all being deprecated this year and realm-web will no longer work or supported (as per the notice and forums)