Document corrupted with _id__baas_transaction: ObjectId("...") field?

I am trying to debug errors I am experiencing when trying to update some documents in one of my collections. After looking closer, I noticed that documents got updated with an additional field:

_id__baas_transaction: ObjectId("[someId]")

Some context:
The given document is created, then updated via GraphQL query (Realm) and then (by mistake) updated again with the same data. During the second update I get an error:

Error: reason=“role \“server\” in \“main-db.Users\” does not have update permission for document with _id: ObjectID(\”[differentId]\"): could not validate document: \n\taccount: email is required"; code=“SchemaValidationFailedWrite”; untrusted=“update not permitted”; details=map[]"

I investigated the issue, and it seems that the document cannot be updated because of the missing email field. That is to be expected. What I do not know is what is _id__baas_transaction and what document is it pointing to.

Hi Alex – There doesn’t appear to be any corruption taking place here, this is simply an internal field that Realm uses to understand whether a document changes as Rules are evaluated / Writes are made. It is not cleaned up on operation completion to minimize load on the database. It should not prevent any operations from completing or impact schema validation for your data.

1 Like

Thank You, @Drew_DiPalma. This explains a lot.

Do you know if:

  1. I can use it for anything? For example, does it relate to some operation, that I could find in logs?
  2. I have to clean it up manually, or will it be automatically removed next the document will be updated?

Hi Alex – I don’t believe there’s a use for this field, it’s really only for internally tracking. It is not cleaned up automatically, but may change as further write are made.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.