[SERVER-59512] Introduce new find API to DBClientBase which uses IDL-generated FindCommandRequest Created: 23/Aug/21 Updated: 29/Oct/23 Resolved: 10/Nov/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 5.2.0 |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Irina Yatsenko (Inactive) | Assignee: | David Storch |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Sprint: | QE 2021-11-01, QE 2021-11-15 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
We will add new methods to DBClientBase called find() and findOne(). These perform the same role as the pre-existing DBClientBase::query() methods, but the caller specifies the find operation that they want to perform using the IDL-generated FindCommandRequest. This will make the internal client code easier to maintain, since whenever the find command IDL specification is modified, the client code will immediately benefit without any explicit changes necessary. Under the hood, the DBClientBase::find() methods will have slightly different logic for constructing the initial OP_MSG find request to send across the wire. In particular, DBClientBase::query() needs to upconvert the request as specified by the caller to a FindCommandRequest so that the find request can in turn be converted to an OP_MSG. This upconversion step is not necessary for the new find() API. This ticket will not complete the work to migrate all the callers off query() and onto find(). That will be achieved as followup work. Once that migration is complete, the query() API and its supporting code can be deleted. In particular the upconversion code mentioned above can be removed! Originally we had a slightly different plan in mind for achieving the same goal. The details of the old plan are outlined below for posterity. Original implementation planImplement steps ##5-8, outlined in the description of 5. Investigate and remove/replace the remaining four callers of fromBSONDeprecated():
6. When all Query construction from raw BSON is gone, the type will only handle a known fixed set of query properties, so it will become possible to replace the internal BSON field 'obj' with statically typed fields, and callers that inspect 'obj' will be able to switch to using specific statically typed accessors instead. There are currently 7 callers like this (search for getFullSettingsDeprecated()). |
| Comments |
| Comment by David Storch [ 10/Nov/21 ] |
|
I filed |
| Comment by Githook User [ 10/Nov/21 ] |
|
Author: {'name': 'David Storch', 'email': 'david.storch@mongodb.com', 'username': 'dstorch'}Message: The new interface uses FindCommandRequest, and avoids any |
| Comment by Githook User [ 10/Nov/21 ] |
|
Author: {'name': 'David Storch', 'email': 'david.storch@mongodb.com', 'username': 'dstorch'}Message: |