Update model.js

This commit is contained in:
Ben Elferink
2020-12-30 19:09:52 +02:00
committed by GitHub
parent 4e901d75ae
commit c2b5e7bccd

View File

@@ -4,9 +4,9 @@ const instance = new mongoose.Schema(
{ {
_id: mongoose.Schema.Types.ObjectId, // _id is set by default, (you can remove this line) _id: mongoose.Schema.Types.ObjectId, // _id is set by default, (you can remove this line)
/* /*
name = property of document object name = property of document object
String = type of value ---> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures String = type of value ---> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures
*/ */
name: String, name: String,
}, },
{ {
@@ -16,6 +16,6 @@ const instance = new mongoose.Schema(
// document = model name ---> https://mongoosejs.com/docs/guide.html // document = model name ---> https://mongoosejs.com/docs/guide.html
// note: use a singular name, mongoose automatically creates a collection like so -> model: 'Person' === collection: 'people' // note: use a singular name, mongoose automatically creates a collection like so -> model: 'Person' === collection: 'people'
const document = 'Example'; const modelName = 'Example';
export default mongoose.model(document, instance); export default mongoose.model(modelName, instance);