Slightly updated template

This commit is contained in:
Ben Elferink
2021-01-12 23:11:28 +02:00
parent 2b1c80743a
commit 41d557dca6
12 changed files with 112 additions and 83 deletions

View File

@@ -3,19 +3,19 @@ import mongoose from 'mongoose';
const instance = new mongoose.Schema(
{
_id: mongoose.Schema.Types.ObjectId, // _id is set by default, (you can remove this line)
name: String,
/*
name = property of document object
String = type of value ---> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures
*/
name: String,
},
{
timestamps: true,
},
);
// modelName ---> 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 model name, mongoose automatically creates a collection like so:
// model: 'Person' === collection: 'people'
const modelName = 'Example';
export default mongoose.model(modelName, instance);