[CDRIVER-3612] mongoc_collection_estimated_document_count should not accept an explicit session Created: 10/Apr/20 Updated: 28/Oct/23 Resolved: 29/Jun/20 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.17.0-rc0, 1.17.0 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Kaitlin Mahar | Assignee: | Roberto Sanchez |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
According to the sessions spec, estimatedDocumentCount should not support an explicit session parameter: https://github.com/mongodb/specifications/blob/master/source/sessions/driver-sessions.rst#new-collection-methods-that-take-an-explicit-session However, I am able to pass one in by appending it to the options bson_t and I've confirmed via command monitoring that the id for the session I specified is being used. The docs section on sessions also makes it seem like you can use this method in a transaction: http://mongoc.org/libmongoc/current/mongoc_collection_estimated_document_count.html |
| Comments |
| Comment by Githook User [ 11/Jul/20 ] |
|
Author: {'name': 'Roberto C. Sánchez', 'email': 'roberto@connexer.com', 'username': 'rcsanchez97'}Message: |
| Comment by Githook User [ 29/Jun/20 ] |
|
Author: {'name': 'Roberto C. Sánchez', 'email': 'roberto@connexer.com', 'username': 'rcsanchez97'}Message: |
| Comment by Githook User [ 26/Jun/20 ] |
|
Author: {'name': 'Roberto C. Sánchez', 'email': 'roberto@connexer.com', 'username': 'rcsanchez97'}Message: |
| Comment by Kevin Albertson [ 26/Jun/20 ] |
|
Given some new information, I now think we should not be changing the behavior of the deprecated helper mongoc_collection_count_with_opts. There are spec tests that expect the deprecated count helper to accept an explicit session: The spec only says that the estimated document count helper should not support an explicit session, and does not say that the deprecated count helpers should be changed in a behavioral backwards breaking way. If we supported an explicit session before, we should probably continue to support an explicit session. Other drivers accept a session argument for their deprecated count helpers. See pymongo and the Java 3.12 driver deprecated helpers. Given all that, I think we should be leaving the deprecated count helper untouched and relying on the server to error. |
| Comment by Kevin Albertson [ 11/Jun/20 ] |
|
We should explicitly raise a client side error if we detect an explicit session passed. The deprecated mongoc_collection_count_with_opts appears to accept a session as well, and documents it. It should also reject an explicit session. |