Misleading information in the https://realm.mongodb.com > SDKs > Data Models > Javascript and Typescript. The code snipped seems like it work for realm-web but that is NOT true (work only for Node.JS SDK).
You can find npm install --save realm-web
and login information on the Realm SDKs panel, which will give you the impression that the code snippet in Data Models will also work. I spend 3h before i read
The Web SDK does not support Realm Database or sync
Please can you add some additional information to Data Models panel?