Is Mongoose better than waterline in a Sails app?
Asked Answered
B

2

6

I am developing a sails.js app. In my previous sails app, I used MySQL with the default waterline ORM. I am planning to use Mongodb in my new app. I have come across limitations with waterline, one of them being, querying an association. My current app is logically intense and deals with a lot of statistical data. Is it safe to continue with waterline or replace it with Mongoose?

Bascule answered 17/6, 2015 at 7:16 Comment(3)
It shouldn't be that difficult to configure mongoose and make it co-exist with your sql orm.Patency
by querying an association do you mean doing sql-like join? In mongoose you can reference the document to other collections and so sql-like join very easily. mongoosejs.com/docs/populate.htmlPatency
I have a db of 20 collections and some of the functions are doing complicated things. (like update user collection, and then update shop collection's user field, and then update some other collections using the new info generated in the previous 2 collections) But if you configure your mongoose connection pool you shouldn't have problems doing these kind of things.Patency
G
2

Waterline is getting better and supports for many features that were missing lately. Since both have association support now, any of them would be fine for this task. Only advantage is Waterline is that if the project is based on Sails, using it would be much easier.

Waterline associations

Gorgias answered 31/8, 2015 at 15:23 Comment(1)
Mongoose doesnt really have associations. It cant do a populate of children unless ids are pushed to the parent.Remnant
C
1

There is an example on Github for a Mongoose ORM Hook that should facilitate the disabling of Waterline and other associated hooks and enabling Mongoose as the ORM to use in your apps.

Csch answered 21/1, 2016 at 11:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.