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?
Is Mongoose better than waterline in a Sails app?
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.html –
Patency
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
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.
Mongoose doesnt really have associations. It cant do a populate of children unless ids are pushed to the parent. –
Remnant
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.
© 2022 - 2024 — McMap. All rights reserved.