added base id to schema

This commit is contained in:
Ben Elferink
2020-12-25 19:18:16 +02:00
parent 14295ca8e5
commit cf21e5cc0f

View File

@@ -1,6 +1,7 @@
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 = property of document object
String = type of value ---> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures
@@ -9,6 +10,7 @@ const instance = new mongoose.Schema({
});
// document = model name ---> https://mongoosejs.com/docs/guide.html
const document = 'example';
// note: use a singular name, mongoose automatically creates a collections like so -> model: 'Person' === collection: 'people'
const document = 'Example';
export default mongoose.model(document, instance);