There are scenarios where certain queries need to omit sub-collections, particularly when the data is being ingested by a third party. Providing a configuration option to disable sub-collection initialization on a per-request basis would be valuable.
Steps to Reproduce
Perform a query using Fireorm that returns documents with sub-collections.
Attempt to omit sub-collections from the query results without additional processing.
Expected Behavior
Ability to configure queries to exclude sub-collections from the results, either on a per-request basis or as a global setting.
Actual Behavior
Currently, sub-collections are always initialized, and developers must manually remove them if not needed.
Acceptance Criteria
Implement a configuration option to disable sub-collection initialization on a per-request basis.
Ensure the feature is optional and enabled by default.
Consider adding a global setting to disable sub-collection initialization for the entire project.
Additional Context
May 21, 2020: Initial issue raised about the need to omit sub-collections from certain queries.
June 6, 2020: Discussion on the feasibility and design of the proposed feature, including the possibility of a project-wide toggle.
Proposed API Changes
Per-Request Configuration:
Add an optional parameter to query methods to disable sub-collection initialization.
Description
There are scenarios where certain queries need to omit sub-collections, particularly when the data is being ingested by a third party. Providing a configuration option to disable sub-collection initialization on a per-request basis would be valuable.
Steps to Reproduce
Expected Behavior
Ability to configure queries to exclude sub-collections from the results, either on a per-request basis or as a global setting.
Actual Behavior
Currently, sub-collections are always initialized, and developers must manually remove them if not needed.
Acceptance Criteria
Additional Context
Proposed API Changes
Per-Request Configuration:
Global Configuration:
Default Behavior:
Implementation Considerations:
Example Usage
Original Issue