I'm using node.js and mongoose and I have a problem.
Here is my model that i'm using:
const mongoose = require('mongoose');
const { Schema } = mongoose;
const prodSchema = new Schema({
name: String,
rate: String,
rate_number: String,
type: String,
offers: {
netflix: {
url: String,
},
amz: {
url: String,
},
},
updated_at: Date,
}, {
collection: 'prod',
});
const ProdModel = mongoose.model('prod', prodSchema);
module.exports = ProdModel;
For exemple I would like to set the netflix url and after set the amz url.
ProdModel.updateOne({ name: currentName },{ offers: { amz: { url: movies[i].url } } });
But when i want for exemple to set the netflix url amz return an empty Object :/