Update collection to enforce schema

Hi All,

Realm DB wants/prefers a fixed schema which is great.

I have a project that has over 100 collections and some collections over 100,000 documents.

How can one:

  1. automate a process that will go through each collection and apply a forced schema to each document. without DELETING any document or data?

  2. What is the correct way using Node.JS to enforce a data schema when creating/modifiying a document?

Thanks in advance

Hi @Barry_Fawthrop,

You can sample your collections using the realm rules section to auto generate the schema.
https://docs.mongodb.com/realm/mongodb/enforce-a-document-schema/

Please note that this reqired for configuration mode sync and graphQL , other sections of realm apps does not require this.
Perhaps you can automate this this through administration API.

Best regards
Pavel