-
-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Description
Describe the bug
After upgrading to Meteor 3.3.1, the matb33:collection-hooks
library no longer works as expected. Using hooks on a collection results in the following error:
TypeError: Cannot read properties of undefined (reading 'insert')
To Reproduce
Steps to reproduce the behavior:
- Create a new collection with
matb33:collection-hooks
andidGeneration: "MONGO"
. - Add a
before.insert
hook, e.g.:
class AggregatedOrdersCollection extends Mongo.Collection {
constructor(name, options) {
super(name, options);
}
findOneByAggregateId = async (aggregate_id) => {}
}
const AggregatedOrdersDB = new AggregatedOrdersCollection(Collections.AGGREGATED_ORDERS, {
idGeneration: "MONGO",
});
AggregatedOrdersDB.before.insert((user_id, doc) => {
const now = dayjs().toDate();
doc["dates"] = {
created_at: now,
updated_at: now,
};
});
- See the error in the console.
Expected behavior
The before.insert
hook should be called correctly, allowing modification of the document before insertion.
Additional context
It seems the issue may be caused by the updated Mongo driver in Meteor 3.3.1. The library might require an update to be compatible with the new mongo
module.
jnoksoko
Metadata
Metadata
Assignees
Labels
No labels