Closed shaharsol closed 3 years ago
Atlas also allows for mongodb:// connection strings. See: https://stackoverflow.com/questions/54986716/node-js-mongoerror-not-authorized-on-admin-to-execute-command/55037826#55037826
Is the support to mongodb+srv
connection strings planned?
I can connect to an atlas db using an existing connection with the native js driver following this guide: https://github.com/jdesboeufs/connect-mongo#connection-to-mongodb
I copied the connection string from the atlas web interface and it follows this form mongodb+srv://user:pass@clustername.mongodb.net/test?retryWrites=true&w=majority
(private details edited)
If you already use mongo for other things you can probably do this.
I have tried that mentioned in @MRVDH advise, but still not working, any help?
with 'mongodb+srv://
string type
getting error (node:16402) UnhandledPromiseRejectionWarning: MongoError: (Unauthorized) not authorized on admin to execute command { insert: "system.indexes", documents: [[{ns admin.sessions} {key [{expires 1}]} {name expires_1} {expireAfterSeconds 0} {unique false}]], ordered: true, writeConcern: { w: "majority" } }
With string as in advise getting err = new MongoError(options); ^ MongoError: connection 0 to MONGO_ATLAS_CONNECTION_URL
Any help?
@IzaGz @shaharsol I have just rewrite the code using TS and published a new version! Can you please help me try it out to see of it fix your issue? https://www.npmjs.com/package/connect-mongo
Atlas enforces that...