Realm Sync error when Schema is defined for a view - find() error when schema is not defined for the same view

Hi everybody,

I have a strange issue on my atlas realm app:

I have partition sync enabled and a view that runs several aggregation stages to combine data.

There are two mutually exclusive errors that are thrown:

when I define a schema for the view, I get TranslatorFatalError with the following message:
recoverable event subscription error encountered: failed to configure namespaces for sync: failed to configure namespace ns=‘sias.siteInfo’ for sync: error issuing collMod command for ns=‘sias.siteInfo’: (InvalidOptions) option not supported on a view: recordPreImages

when I remove the schema for the view, i get NoMatchingRuleFound with the following message:
Action on service ‘mongodb-atlas’ forbidden: arguments to ‘find’ don’t match rule criteria

{
  "name": "find",
  "arguments": [
    {
      "database": "sias",
      "collection": "siteInfo",
      "query": {}
    }
  ],
  "service": "mongodb-atlas"
}

Does someone encountered the same issue?
How can I disable recordPreImages for the view? (is not showed in “linked data source” advanced config options…)

thanks

Hi, Sync is not supported on views currently for a multitude of reasons, the chief one being that they are read-only. Perhaps we can surface this in a nicer way, but the recordPreImages check is another thing that Sync needs and views do not support. I will follow up with the Docs team to make sure this is documented somewhere.

Thanks,
Tyler

Hi @Tyler_Kaye , thank you for your reply.

I’ve found a workaround for this:

  1. remove the Schema for the view
  2. create a role “readAll” for the view

this fixed all the errors for me.

I hope this will help other users with the same issue.

As a warning, if there is no schema defined then the collection is not being synced.

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