aaa
This commit is contained in:
@@ -139,7 +139,10 @@ const productSchema = new Schema({
|
||||
},
|
||||
producer_name: {
|
||||
type: String,
|
||||
}
|
||||
},
|
||||
fornitore_name: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
|
||||
var Product = module.exports = mongoose.model('Product', productSchema);
|
||||
@@ -289,9 +292,13 @@ module.exports.convertAfterImport = async function () {
|
||||
|
||||
const campodarimuovere = 'producer_name';
|
||||
|
||||
let ris = null;
|
||||
|
||||
if (recproducer) {
|
||||
await Product.findOneAndUpdate({ _id: prod._id }, { $set: { idProducer: recproducer._id } })
|
||||
await Product.findOneAndUpdate({ _id: prod._id }, { $unset: { [campodarimuovere]: 1 } })
|
||||
ris = await Product.findOneAndUpdate({ _id: prod._id }, { $set: { idProducer: recproducer._id } })
|
||||
console.log('Ris', ris);
|
||||
ris = await Product.findOneAndUpdate({ _id: prod._id }, { $unset: { [campodarimuovere]: 1 } })
|
||||
console.log('Ris', ris);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user