Answers for "Data in MongoDB has a flexible schema where documents are in _____ collection and may hold different types of data"

Go
0

what is model schema document in mongo db

var personSchema = new Schema({
    name: { type: String, default: 'anonymous' },
    age: { type: Number, min: 18, index: true },
    bio: { type: String, match: /[a-zA-Z ]/ },
    date: { type: Date, default: Date.now },
});

var personModel = mongoose.model('Person', personSchema);
var comment1 = new personModel({
    name: 'Witkor',
    age: '29',
    bio: 'Description',
});

comment1.save(function (err, comment) {
    if (err) console.log(err);
    else console.log('fallowing comment was saved:', comment);
});
Posted by: Guest on July-21-2020

Code answers related to "Data in MongoDB has a flexible schema where documents are in _____ collection and may hold different types of data"

Browse Popular Code Answers by Language