mongoClient vs mongoose

Hi mongodbians,
I am new to MongodDB , while I am connecting to db I see there are two ways of connecting one is through mongoClient.connect and the other is Mongoose.connect I don’t know which one is better
can any one explain detail difference and usage

1 Like

AFAIK, Under the hood, mongoose uses mongoClient to connect to the server;

However, I can tell you few differences between these two connects;

  • mongoose returns promise, mongoclient returns null

  • mongoose connect is backed by an internal configurable connection pool

These are the 2 differences I can think top of my head right now, I am sure there are more other…

3 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.