1

const db = mongoose.model('User', userSchema, 'user')

What is use of that third parameter? Where can we use that parameter. What is use of that parameter. Any practical example

  • Does this answer your question? [Third argument when creating model in MongooseJS](https://stackoverflow.com/questions/26390448/third-argument-when-creating-model-in-mongoosejs) – Abhishek Bhagate Sep 07 '20 at 18:00

1 Answers1

2

The third parameter is an explicit collection name.

Once I faced this use case , we had client and he want to have a prefix for each collection name when it get created in db ,something like "apple_users" , in that case it was useful

Shubham
  • 1,396
  • 9
  • 17