diff --git a/pymongo/database.py b/pymongo/database.py index 358b946201..1e19d860e3 100644 --- a/pymongo/database.py +++ b/pymongo/database.py @@ -740,10 +740,10 @@ def command( >>> db.command("buildinfo") - For a command where the value matters, like ``{collstats: + For a command where the value matters, like ``{count: collection_name}`` we can do: - >>> db.command("collstats", collection_name) + >>> db.command("count", collection_name) For commands that take additional arguments we can use kwargs. So ``{filemd5: object_id, root: file_root}`` becomes: diff --git a/test/test_examples.py b/test/test_examples.py index 9c1adda69c..c08cb17e20 100644 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -869,7 +869,7 @@ def test_commands(self): # End runCommand Example 1 # Start runCommand Example 2 - db.command("collStats", "restaurants") + db.command("count", "restaurants") # End runCommand Example 2 def test_index_management(self): diff --git a/test/unified-test-format/valid-pass/collectionData-createOptions.json b/test/unified-test-format/valid-pass/collectionData-createOptions.json index 64f8fb02ff..19edc2247b 100644 --- a/test/unified-test-format/valid-pass/collectionData-createOptions.json +++ b/test/unified-test-format/valid-pass/collectionData-createOptions.json @@ -49,19 +49,29 @@ "description": "collection is created with the correct options", "operations": [ { - "name": "runCommand", - "object": "database0", + "object": "collection0", + "name": "aggregate", "arguments": { - "commandName": "collStats", - "command": { - "collStats": "coll0", - "scale": 1 - } + "pipeline": [ + { + "$collStats": { + "storageStats": {} + } + }, + { + "$project": { + "capped": "$storageStats.capped", + "maxSize": "$storageStats.maxSize" + } + } + ] }, - "expectResult": { - "capped": true, - "maxSize": 4096 - } + "expectResult": [ + { + "capped": true, + "maxSize": 4096 + } + ] } ] }