fireorm icon indicating copy to clipboard operation
fireorm copied to clipboard

RFC: Turn subcollection initialisation off for certain queries?

Open joemckie opened this issue 4 years ago • 1 comments

I've come across certain queries that I would like to omit sub-collections from (the data is being ingested by a third party and essentially I need the document data, not a FireORM instance).

Would there be any value in turning this off in a per-request config? I was thinking something like this:

getRepository(Product).findById('1234', { initializeSubcollections: false });

This would of course be optional and true by default!

It does seem a little hacky to me, but it beats the alternative of removing the subcollections via destructuring.

joemckie avatar May 21 '20 19:05 joemckie

Sorry it took me that much time to reply!

Yes, that seems to be a good idea. Maybe have a toggle to disable subcollection initialization on a project basis (setting something in the initialize) and maybe per query as you suggested.

wovalle avatar Jun 06 '20 17:06 wovalle