loopback-component-storage-mongo
loopback-component-storage-mongo copied to clipboard
the options [connector,hostname, etc.] is not supported
mongodb.connect method accepts 3 arguments url, options and callback. In the connect method of the module settings object is passed as options. So some of the fields are not supported by mongodb client.
Settings is something that loopback passes from datasources.[env].json when creating a datasource. Maybe it's a good idea to pass settings.options instead of the entire object to mongodb.connect? In datasources.[env].json:
"storage": {
"name": "storage",
"connector": "loopback-component-storage-mongo",
"host": "127.0.0.1",
"database": "test",
"port": 27017,
"options": {
"mongoConnectionOption1": "value"
}
}
connect: (callback) ->
self = @
if @db
process.nextTick ->
if callback
callback null, self.db
else
mongodb.MongoClient.connect @settings.url, @settings.options, (err, db) ->
if not err
debug 'Mongo connection established: ' + self.settings.url
self.db = db
if callback
callback err, db
Annoying warning: the options [connector] is not supported the options [hostname] is not supported the options [port] is not supported the options [debug] is not supported the options [url] is not supported
Same here but seems the project is not updated anymore
i have the same issue... there are any solutions or forks for it?
I've created a pull request that solves that issue #18
Nice catch! I was searching what was causing this for some time now. Hope this changes is pushed soon