Why do I need to provide a name when creating a new model?
I am just starting to learn MongoDB and Mongoose, I cannot get the point of the first argument to the function model
. Why do I need to specify a string as a name and what is the purpose?
// Schema
var CustomerSchema = mongoose.Schema({
name: String
});
// Model, that is the constructor
var Customer = mongoose.model('Customer', CustomerSchema);
// Instance, a particular customer
var john = new Customer({});
+3
source to share