Kickasstimus
Kickasstimus

Reputation: 197

How can I get data into a Sails.js app from a MongoDB?

I have a Sails.js app that needs to fetch from a Mongo database, then display that data in a graph. Alternately, it can take data from a JSON file located on the server.

I am struggling with that process immensely. What seems like it should be an easy task is anything but. I should mention that I am not terribly familiar with Sails.js, but this is what I was directed to use.

I am seeking either examples, documentation, advice, pointers, alternatives, basically anything that would point me in the right direction.

I realize that this is likely to generate a lot of opinion over the "best" and that's not what I am after. I am looking for direction towards resources or guidance on technique.

Thanks.

Upvotes: 0

Views: 127

Answers (1)

Ahmed farag mostafa
Ahmed farag mostafa

Reputation: 2934

you can read this link to understand how integrate mongodb with sails.js

i will list logic steps to understand how you can get data

  • after install mongodb-sails driver in package.json to open connection between sails and mongodb
  • you have to define model which map your mongodb documents to Models
  • define model attributes
  • you can use waterline to get document , findbycolumnname and make CRUD operations

Upvotes: 2

Related Questions