Details
-
Bug
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
2.6.3
-
None
-
None
Description
This is surprising. If there's a file in a GridFS collection with no filename, GridFS.list doesn't include None. But after calling get_last_version or get_version, list will include None:
>>> import pymongo
|
>>> import gridfs
|
>>> client = pymongo.MongoClient()
|
>>> fs = gridfs.GridFS(client.db)
|
>>> fs.put(b'hello')
|
ObjectId('52882cf5ca1ce99eed9a0524')
|
>>> fs.list()
|
[]
|
>>> fs.get_last_version()
|
<gridfs.grid_file.GridOut object at 0x1012cb4d0>
|
>>> fs.list()
|
[None]
|
This is because get_last_version or get_version ensure an index on (filename, uploadDate). list calls distinct on filename, and the distinct command behaves differently depending on whether it uses an index or not: SERVER-11747.
Attachments
Issue Links
- depends on
-
SERVER-11747 Inconsistent behavior of "distinct" with index
-
- Closed
-