paku
December 23, 2017, 11:22pm
1
Hi,
Spent hours trying to make it working:
x.update({ _id: xID }, { $pull: { history: { historyID: givenhistoryID } } });
where history is an array inside collection, and historyID is a random.id ()
Have no luck, still getting infamous “After filtering out keys not in the schema, your modifier is now empty”.
It it possible to remove array item from SimpleSchemed collection2 ???
Same problem as:
https://github.com/aldeed/meteor-collection2/issues/245
1 Like
No experience with this issue. A workaround might be to fetch the record first, then use lodash to filter out the item from the array and then use $set to update the entire array. This is one of the reasons why I try to avoid 'subarrays at all cost in MongoDB.
paku
December 24, 2017, 1:43pm
3
It was my fault finally. I missed some schema structure information as well as field name
it’s working like this:
x.update({ _id: xID }, { $pull: { YYY.history: { historyId: givenhistoryID } } });
array was one level deeper and index field name was 'historyIdnot
historyID`.
1 Like