Answer the question
In order to leave comments, you need to log in
How to prevent creating _id in SubDocument?
There is the following schema:
const {Schema, model, Types} = require('mongoose');
const schema = new Schema({
label: {type: String, required: true},
data: [{
x: {type: Number},
y: {type: String}
}],
color: {type: String, required: true},
instrument: {type: Types.ObjectId, ref: 'Instruments', required: true}
},
{
versionKey: false
}
);
module.exports = model('Strategy', schema, 'Strategies');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question