Hi there fellow coders,
Maybe one of you could bridge the gap I seem to be having.
I'm new to Mongo and tried to set up a database. Then created a Realm App.
According to the documentation (https://docs.mongodb.com/realm/web/mongodb/), I need to link a data source(https://docs.mongodb.com/realm/mongodb/link-a-data-source/).
Having done that, the doco seems to indicate I should be able to use the line:
const mongo = app.services.mongodb("<atlas service name>");
However, I get an error saying "Cannot read property 'mongodb' of undefined". Obviously, it's because there is no services against app.
I tried looking this up online, but found no answers. Hoping someone experienced could guide me as to what is missing or what I'm clearly not seeing.
TIA!
Are you using MongoDB 4.4?
Are you using MongoDB Atlas? Realm sync does not work for on-premises MongoDB.
If you're using all that, I would go to https://realm.mongodb.com and click "Create a New App" and then the screen that shows up, you pick the cluster to connect with and that's the service. (or choose the 'we'll create one for you' option).

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With