What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-29 06:50:07
auto increment in mongoose + nodejs
... var bookSchema = new Schema({ author: { type: Schema.Types.ObjectId, ref: 'Author' }, title: String, genre: String, publishDate: Date }); bookSchema.plugin(autoIncrement.plugin, 'Book'); var Book = connection.model('Book', bookSchema)... Add solution -
Javascript 2021-10-25 19:36:10
mongoose reference another model
var mongoose = require('mongoose') , Schema = mongoose.Schema var eventSchema = Schema({ title : String, location : String, startDate : Date, endDate : Date }); var personSchema = Schema({ firstname: String, lastname: St... Add solution -
Javascript 2021-09-01 01:33:02
mongoose query foreign key
const mongoose = require('mongoose'); const personSchema = mongoose.Schema({ _id: Schema.Types.ObjectId, name: String, age: Number, stories: [{ type: Schema.Types.ObjectId, ref: 'Story' }] }); const storySchema = mongoose.Schema({ author: { ty... Add solution
Best helpers
Holyeyeolo
+5
Auntkym
+5
Mostafa 36a2
+5
RoToRa
+5
Rodrigorgs
+5
Matt2507864
+5
Arnav Bose
+5
Waldrumpus
+5
TheShade
+5
Naigel
+5
A10ciod
+5
Rev1.0
+5
Babak
+5
Ohhh
+5
Jeff Sours
+5
Jim Mourgos
+5
J. Marks
+5
Piquet
+5