- Aggiornato node.js alla versione 22.18.1
- Aggiornato tutti i pacchetti del server all'ultima versione. - passato mongoose da versione 5 a versione 6
This commit is contained in:
@@ -131,9 +131,10 @@ const orderSchema = new Schema({
|
||||
|
||||
var Order = module.exports = mongoose.model('Order', orderSchema);
|
||||
|
||||
module.exports.createIndexes((err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
module.exports.createIndexes()
|
||||
.then(() => { })
|
||||
.catch((err) => { throw err; });
|
||||
|
||||
|
||||
module.exports.getFieldsForSearch = function () {
|
||||
return []
|
||||
@@ -377,7 +378,7 @@ module.exports.updateTotals = function (order) {
|
||||
|
||||
module.exports.getTotalOrderById = async function (id) {
|
||||
const query = [
|
||||
{ $match: { _id: ObjectId(id) } },
|
||||
{ $match: { _id: new ObjectId(id) } },
|
||||
{
|
||||
$lookup: {
|
||||
from: 'products',
|
||||
@@ -642,7 +643,7 @@ module.exports.RemoveDeletedOrdersInOrderscart = async function () {
|
||||
if (!orderCart) {
|
||||
// NON TROVATO ! Allora lo cancello
|
||||
|
||||
await Order.findOneAndRemove({ _id: ord._id });
|
||||
await Order.findOneAndDelete({ _id: ord._id });
|
||||
}
|
||||
})
|
||||
.catch(err => console.error(err));
|
||||
@@ -660,7 +661,7 @@ module.exports.GeneraCSVOrdineProdotti = async function () {
|
||||
const myidGasordine = '65c2a8cc379ee4f57e865ee7';
|
||||
|
||||
const myquery = [
|
||||
{ $match: { idGasordine: ObjectId(myidGasordine) } },
|
||||
{ $match: { idGasordine: new ObjectId(myidGasordine) } },
|
||||
{
|
||||
$lookup: {
|
||||
from: 'products',
|
||||
|
||||
Reference in New Issue
Block a user