After adding the collection-hooks package, I am now getting errors anywhere I have a call to find one that is set to only return specific fields and not include the _id field, such as:
var orderItems = Orders.findOne({_id:orderID},{fields:{_id:0,items:1}});
causes:
Exception while invoking method 'ProcessItems' Error: can only transform documents with _id
at [object Object].wrapped [as _transform] (packages/minimongo/packages/minimongo.js:1099:1)
at [object Object]._.extend._nextObject (packages/mongo/mongo_driver.js:1003:1)
at [object Object]._.extend.forEach (packages/mongo/mongo_driver.js:1020:1)
at [object Object]._.extend.map (packages/mongo/mongo_driver.js:1030:1)
at [object Object]._.extend.fetch (packages/mongo/mongo_driver.js:1054:1)
at [object Object].Cursor.(anonymous function) [as fetch] (packages/mongo/mongo_driver.js:869:1)
at [object Object].MongoConnection.findOne (packages/mongo/mongo_driver.js:776:1)
at Object.collection.(anonymous function) [as findOne] (packages/matb33_collection-hooks/collection-hooks.js:104:1)
at [object Object]._.extend.findOne (packages/mongo/collection.js:305:1)
at packages/matb33_collection-hooks/collection-hooks.js:98:1
Even though that particular collection doesn't have any hooks.
Changing to
var orderItems = Orders.findOne({_id:orderID},{fields:{items:1}});
gets rid of the exception, so it's easy to work around, I just didn't find any mention or warning about this in the documentation anywhere. Not sure that it's a bug or just a necessity of how collection hooks works, though it seems if a collection doesn't have any hooks, the package shouldn't be stepping into the middle of the processing and requiring the _id field like this. Makes me a little concerned about how much extra overhead this package is adding to each and every collections call.
After adding the collection-hooks package, I am now getting errors anywhere I have a call to find one that is set to only return specific fields and not include the _id field, such as:
causes:
Even though that particular collection doesn't have any hooks. Changing to
gets rid of the exception, so it's easy to work around, I just didn't find any mention or warning about this in the documentation anywhere. Not sure that it's a bug or just a necessity of how collection hooks works, though it seems if a collection doesn't have any hooks, the package shouldn't be stepping into the middle of the processing and requiring the _id field like this. Makes me a little concerned about how much extra overhead this package is adding to each and every collections call.