Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
None
Description
Using these versions
pymongo '3.11.0'
mongo '4.2.6'
when i run this i get back a couple of collections as expected
collections = client.core.list_collection_names()
|
when i run this for a collection name that doesn't exist in the database i get the below output.
tats = client.core.command("collstats", 'idontexist') |
{{ 'sharded': False, 'primary': 'rs2', 'indexDetails': {}, 'ns': 'core.idontexist', 'count': 0, 'size': 0, 'storageSize': 0, 'totalIndexSize': 0, 'indexSizes': {}, 'avgObjSize': 0.0, 'maxSize': 0, 'nindexes': 0, 'nchunks': 1, 'shards': { 'rs2': { 'ns': 'core.idontexist', 'size': 0, 'count': 0, 'storageSize': 0, 'nindexes': 0, 'totalIndexSize': 0, 'indexDetails': {}, 'indexSizes': {}, 'scaleFactor': 1, 'ok': 1.0, '$gleStats': { 'lastOpTime': Timestamp(0, 0), 'electionId': ObjectId('7fffffff0000000000000001') }, 'lastCommittedOpTime': Timestamp(1599457270, 1), '$configServerState': { 'opTime': { 'ts': Timestamp(1599457268, 2), 't': 2 } }, '$clusterTime': { 'clusterTime': Timestamp(1599457270, 1), 'signature': { 'hash': b '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'keyId': 0 } }, 'operationTime': Timestamp(1599457270, 1) } }, 'ok': 1.0, 'operationTime': Timestamp(1599457270, 1), '$clusterTime': { 'clusterTime': Timestamp(1599457270, 1), 'signature': { 'hash': b 'm\xa5e_]#\x97\xb6\x8a\xdd\x16}\xc8 \xaas\x90\x8e\xaf\xeb', 'keyId': 6833584828143632415 } }}
|
which is odd because the documentation says:
"If the collection does not exist, collStats returns an error message."
Just curious if this is expected behaviour ? Shouldn't pymongo have returned an error ?
Thanks.
Attachments
Issue Links
- depends on
-
SERVER-51206 collStats command does not return an error when the collection does not exist on sharded clusters
-
- Backlog
-
- is caused by
-
SERVER-29678 collStats should return ok:1 and all fields when the namespace does not exist
-
- Closed
-