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

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…

2 Likes