Update/Upsert field with certain array index?


#1

I am trying to upsert a specific array, for example the first one in printmarks. Since it’s an array I can’t select it with a value but like below doesn’t work. I’m guessing meteor takes this as a string rather than actually looking for the correct index, right? How can this be done?

  VendorProducts.upsert(
    {
      _id: vendorId._id//, 
    },
    {
    $set: 
            {'requirements.printmarks[0].active': true}
    }
  );

#2
VendorProducts.update({
  _id: vendorId:
  "yourarray.$.yourkey": thing
}, {
  $set: {
    'yourarray.$': thing
  }
});

#3

Thanks a lot, this did the trick!