Meteor-Community-Packages / meteor-collection-hooks

Meteor Collection Hooks
https://atmospherejs.com/matb33/collection-hooks
MIT License
657 stars 92 forks source link

does `this.transform()` make calls to the db? #166

Closed faceyspacey closed 7 years ago

faceyspacey commented 8 years ago

It seems this.transform() is retrieving more data than is sent by an update/insert call. So is it making an additional read to the database to get it?

And if I don't use transform without a parameter, will it make that read anyway, i.e. if I do instead: this.transform(modifier.$set) as an optimization?

Or am I missing something about this whole thing for why the server already has the entire document. I'm operating under the assumption it doesn't have the entire document. Rather the client sends the minimum # fields I'd like to change to the server, and the server does the same passing that on to Mongo, without ever having full knowledge of the document. So I guess the question is: is this.transform() lazy?

zimme commented 7 years ago

this.transform() don't make calls to the db, but there where cases when unnecessary calls to fetch documents where made even when no hooks were added.

This should be in the next release.