-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.13
-
Component/s: None
-
None
-
Python Drivers
We're working on PM-3120, the server backport of query stats. The $queryStats aggregation stage returns query "shapes" from user queries with literals and field paths transformed but keywords retained.
While backporting the server's v6.0, we ran into an issue on PyMongo version 3.13.0. We have a query that gets returned as a result document of $queryStats after being transformed to the following:
{links: {$elemMatch: {$and: [{$ref: {$eq: "?object"}}, {$id: {$eq: "?object"}}]}}}
The driver attempts to create a DBRef object out of the $ref object but fails with "collection must be an instance of str."
We've run successfully the same test with PyMongo version 4.3.3. Looking at the source code (bson package, _init_.py / dbref.py files), it seems that a change was made between the two versions to do some extra validation before creating a DBRef object that ends up filtering out this invalid case (i.e. not treating it as a DBRef at all).
Is there a backport process of some kind to resolve the error on the earlier version?
(Also, I can attach more diagnostic info if needed. This is reproducible on our backport branch.)
- duplicates
-
PYTHON-2680 Driver Handling of DBRefs
- Closed