Mongoose - Generate ObjectID for each object before saving document
问题 I want generate an ObjectID for each Object present inside my array. The thing is I'm getting the products with a .forEach statement from another server and push them inside my array without a Schema that generates an ObjectID.... Product Schema: const productsSchema = new mongoose.Schema({ apiKey: String, domain: String, totalcount: Number, totaldone: Number, allSKUS: Array, allProducts: Array, created_at: { type: Date }, updated_at: { type: Date }, }, { collection: 'products', timestamps: