I am using mongoose and referring to api https://mongoosejs.com/docs/api/mongoose.html
My package.json says "mongoose": "^7.4.0" so I am not sure which specific version I am on. Assuming it is 7.5.0, I am using connect call to connect to mongodb via mongoose
const connection = await mongoose.connect(process.env.DATABASE_URL);
var localdbClient = connection.connections[0].client;
I can’t find where in the document it says that connection has connections array. Where is it mentioned? Is the type of connection[] a connection? This doesn’t say so – https://mongoosejs.com/docs/api/mongoose.html
How should I refer to the api and definitions?
>Solution :
The connections array is documented here: https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.connections
But apparently, what you really want here is getClient():
https://mongoosejs.com/docs/api/connection.html#Connection.prototype.getClient()