Details
-
Bug
-
Resolution: Done
-
Major - P3
-
3.0
-
None
-
None
-
pymongo==3.0.1-2-81549e
Description
This is a really strange one...
When connecting through a mongos, I'm seeing an issue where find_one with PRIMARY_PREFERRED doesn't return any output.
c = ...some_collection ...
|
c.with_options(read_preference=ReadPreference.PRIMARY_PREFERRED)
|
c.find_one({'symbol': symbol}, sort=[('version', pymongo.DESCENDING)])
|
returns None. Whereas:
c.find_one({'symbol': symbol})
|
return an item.
len(list(c.find({'symbol': symbol}))
|
Out[76]: 25
|
|
In [79]: [x for x in list(c.find({'symbol': symbol})) if x is None]
|
Out[79]: []
|
Note a normal find finds nothing too.
In [84]: c = lib._versions.with_options(read_preference=ReadPreference.PRIMARY_PREFERRED)
|
In [85]: len(list(c.find({'symbol': symbol}, sort=[('version', pymongo.DESCENDING)])))
|
Out[85]: 0
|
If I change the read-preference, it works!
In [82]: c = lib._versions.with_options(read_preference=ReadPreference.PRIMARY)
|
In [83]: len(list(c.find({'symbol': symbol}, sort=[('version', pymongo.DESCENDING)])))
|
Out[83]: 25
|
Attachments
Issue Links
- is duplicated by
-
PYTHON-935 Setting $maxTimeMS raises OperationFailure when connecting through mongos (with ReadPreference.NEAREST)
-
- Closed
-