I would like to use mongo js and mongoose in the same app.I require mongo js as i don't want write schema for a specific functionality of the app as it includes nested and complex data.I tried mongoose but that just makes it more difficult.With mongojs I could directly write mongodb queries and execute.Whereas for other functionalities like validation and simple schema,mongoose would be better so can I use both. I would be connecting to db in the controller and not app.js,although I know I would require to connect every time,but I think thats the only way.
Asked
Active
Viewed 690 times
1
-
i think yes.. did u try using both together? – null1941 Feb 10 '16 at 06:03
-
No i havent tried it .I think its possible but is it good switching and using both?@null1941 – Mohammed Gadiwala Feb 10 '16 at 06:09
2 Answers
1
Yes, we're actually using multiple drivers, in a production application. We need connections to multiple databases, and mongoose is only able to connect to one DB. So we use MongoDB for the connections to the secondary databases. It should be the same using MongoJS instead.

Antoine
- 5,055
- 11
- 54
- 82
-
-
No, we're using the official mongoDB driver, but it should be the same with Mongojs. let me edit my answer. – Antoine Feb 10 '16 at 10:37
0
Yes, in fact I do this currently for a few reasons. Mongoose carries a bit of overhead with its serialization and I ran into issues with it handling a large amount of operations at scale. When we need to do heavy lifting with our collections: inserting/updating 10s of millions of times, I prefer to use something a bit closer to the metal and we use mongojs for that.

Jake Dempsey
- 6,264
- 1
- 30
- 25
-
No i havent tried it .I think its possible but is it good switching and using both? – Mohammed Gadiwala Feb 10 '16 at 06:10