Documents can be big.
They can even contain many fields.
Modifying one specific field separately is unfortunately not supported and this is a big predicament
After I got over it, I started to think of clever ways to solve it.
I split my POCOs virtually to 2 parts. The first one handles all the small fields and the other handles the big, heavy and more static stuff (mainly write once). Each part has its own key. Together they constitute the entire information.
My POCO can read either the small key or the big key (or both in parallel) and populate only the members that got fetched. When updating I must be careful not to save the partial POCO in the wrong place as it contains only partial info.
If I need both the big ans small parts I need to make 2 get requests and merge them to one POCO, member by member.
If I need both big and small parts and then I need to modify only the small, I need to nullify the big’s class members before update to prevent them from being saved in the small document.
This solves the issue of one big POCO (that reads the entire document every time) and the issue of 2 separate smaller ones (which split a valid class members and requires double handling).
I hope the situation is clear, basically it is about partial read and partial update a big document to reduce bandwidth, processing power and latency.
Basically, my questions are:
- Is there a better way to handle partial updates ?
- Is there a way to get only selected fields using .Net SDK ?