I’ve come across the error ‘Failed validation The positional operator did not find the match needed from the query.’ in a few different places in our codebase when trying to use updateAsync to set an object in the DB. It looks like the error is originating from the aldeed:collection2@4.1.4 package. I’m not sure if this is something I am doing wrong or if it’s an actual issue but any help is appreciated.
The schema:
const orderSchema = new SimpleSchema({
appointment: {
    type: Object,
    label: 'Appointment',
    optional: true,
    security: {
      public: false,
    }
  },
  'appointment.dateTime': {
    type: Date,
    label: 'Date and time of appointment',
    optional: true,
    security: {
      public: false,
    }
  },
  'appointment.date': {
    type: String,
    label: 'Date of appointment',
    optional: true,
    security: {
      public: false,
    }
  },
  'appointment.time': {
    type: String,
    label: 'Time of appointment',
    optional: true,
    security: {
      public: false,
    }
  },
  'appointment.type': {
    type: String,
    label: 'Type of appointment',
    allowedValues: ['appointment', 'walkin'],
    optional: true,
    security: {
      public: false,
    }
  },
  'appointment.notes': {
    type: String,
    label: 'Walk-in notes',
    optional: true,
    security: {
      public: false,
    }
  },
});
The updateAsync:
const appointmentData = {};
    if (appointment.type === 'appointment') {
      appointmentData.appointment = {
        dateTime: appointment.dateTime,
        date: appointment.date,
        time: appointment.time,
        type: appointment.type,
      };
    } else {
      appointmentData.appointment = {
        type: appointment.type,
        notes: appointment.notes
      };
    }
await Orders.updateAsync({
      _id: orderId
    }, {
      $set: appointmentData
    });
I’ve tried a few different syntax changes and ways of structuring the object but nothing seems to help.
The current workaround I have is to change the updateAsync to rawCollection().updateOne() but you lose out on the instant reactivity from Meteor when you using that so I’d like to find a solution to why our updateAsync’s are failing.
- Meteor version: 3.2.2
 - Browser: chrome
 - aldeed:collection2@4.1.4