taking multiple inputs as a field (Schema) Get link Facebook X Pinterest Email Other Apps July 30, 2025 tags:[String] Read more
assigning updatedAt field Get link Facebook X Pinterest Email Other Apps July 30, 2025 updatedAt:{ type:Date, default:Date.now } ___Schema.pre("save", function(next){ this.updatedAt: Date.now(); next(); }); Read more
giving mongoDB userId as official userId for user schema Get link Facebook X Pinterest Email Other Apps July 30, 2025 userId:{ type:mongoose.Schema.Types.ObjectId, ref:"User", required:true } Read more
assigning value between two options in a mongoDB Schema Get link Facebook X Pinterest Email Other Apps July 30, 2025 we use enum to allocate value between two options status: { type: String, enum: ["draft", "published"], default: "draft" } Read more