[CDRIVER-2356] Refactor aggregation with serverId Created: 10/Nov/17  Updated: 07/Mar/23  Resolved: 07/Mar/23

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: A. Jesse Jiryu Davis Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: bgtrack
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The code path from mongoc_collection_aggregate when "opts" contains "serverId" calls _mongoc_get_server_id_from_opts twice, once with empty opts and once with the caller's opts.



 Comments   
Comment by Rishabh Bisht [ 07/Mar/23 ]

Closing as per above comments.

Comment by Kevin Albertson [ 06/Mar/23 ]

This may have changed, but it still appears that there is double parsing of "serverId".

_mongoc_aggregate calls _mongoc_aggregate_opts_parse which parses serverId from options.

_mongoc_aggregate calls _mongoc_cursor_cmd_new calls _mongoc_cursor_new_with_opts calls _mongoc_get_server_id_from_opts.

I suggest closing. The refactor may save remove a duplicate search, but IMO does not provide much value.

Generated at Wed Feb 07 21:14:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.