-2

Am trying to connect to mongodb throw my node js app using this line:

const db = mongoskin.db("mongodb://localhost:27017/todo?auto_reconnect", {safe:true});

but it always gives me error: enter image description here

And here screen shot from my code sample: enter image description here

FisNaN
  • 2,517
  • 2
  • 24
  • 39
  • You should copy & paste the source code here directly - easier to test for others, easier to read, and the question stays valid after your uploaded image became invalid. Apart from that, did you try connecting with `auto_reconnect=true` instead? Are you sure that you need auto_reconnect and why you want to use it (because [others where not](https://github.com/kissjs/node-mongoskin/issues/30) and I don't remember ever requiring that option myself)? – Martin Bories Mar 25 '18 at 22:29

1 Answers1

0

Please read documentation: https://docs.mongodb.com/manual/reference/connection-string/#connections-connection-options

Connection options are pairs in the following form: name=value. The value is always case sensitive.

What version of MongoDB? In latest documentation i cant find any option called auto_reconnect so It isnt required.

Artur P.
  • 886
  • 4
  • 12