Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

npm install download incompatible MongoClient version #102

Closed
davidnussio opened this issue Dec 9, 2017 · 2 comments
Closed

npm install download incompatible MongoClient version #102

davidnussio opened this issue Dec 9, 2017 · 2 comments

Comments

@davidnussio
Copy link
Contributor

This is not a bug but now installing mongodb npm download the 3.0.0-rc0 version.
MongoClient.connect return client instead db.

The code generated with feathers-cli failed with the error:
TypeError: db.collection is not a function

  • Fix with downgrade mongodb version to 2.2.x
  • Fix follow the example below
const MongoClient = require('mongodb').MongoClient;
const service = require('feathers-mongodb');

MongoClient.connect('mongodb://localhost:27017/feathers').then(client => {
  app.use('/messages', service({
    Model: client.db('feathers').collection('messages')
  }));
  app.use('/messages', service({ Model, id, events, paginate }));
});
@daffl
Copy link
Member

daffl commented Dec 9, 2017

If you could update the example that would be great. The latest generator already has been updated in feathersjs-ecosystem/generator-feathers#318.

@daffl
Copy link
Member

daffl commented Jan 2, 2018

Closed via #103

@daffl daffl closed this as completed Jan 2, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants