marcello3d / node-mongolian

[project inactive] Mongolian DeadBeef is an awesome Mongo DB driver for node.js
https://groups.google.com/group/node-mongolian
zlib License
350 stars 50 forks source link

server/db connection params (host, port) #32

Closed bingomanatee closed 13 years ago

bingomanatee commented 13 years ago

How do you connect to a database on a different host, port, etc.?

marcello3d commented 13 years ago

You just add a url parameter to the constructor, e.g.:

new Mongolian("mongo://foo.com:12345")

There should be an example on the readme under the "Connections and Authentication" section. Do you think it could be clearer?

dvv commented 13 years ago

new Mongolian("mongo://foo.com:12345") results in database name be string 'undefined'. couldn't you make it default to, say, 'test'? TIA, --Vladimir

bingomanatee commented 13 years ago

scary. If you don't define something, it should be undefined. Though not the STRING "undefined". thats even scarier. I want it to fail.

marcello3d commented 13 years ago

new Mongolian("mongo://foo.com:12345") should not result in any database object at all. It should result in a server connection. From there you would call the db method to get a database instance. Defaulting to 'test' is extremely error-prone.

How are you determining the name is undefined?