Skip to content

Commit ae83a0b

Browse files
authored
PYTHON-3570 Deprecate currentOp/collStats commands by 7.0 (#1205)
1 parent 3d3e4dc commit ae83a0b

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

pymongo/database.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,10 +740,10 @@ def command(
740740
741741
>>> db.command("buildinfo")
742742
743-
For a command where the value matters, like ``{collstats:
743+
For a command where the value matters, like ``{count:
744744
collection_name}`` we can do:
745745
746-
>>> db.command("collstats", collection_name)
746+
>>> db.command("count", collection_name)
747747
748748
For commands that take additional arguments we can use
749749
kwargs. So ``{filemd5: object_id, root: file_root}`` becomes:

test/test_examples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ def test_commands(self):
869869
# End runCommand Example 1
870870

871871
# Start runCommand Example 2
872-
db.command("collStats", "restaurants")
872+
db.command("count", "restaurants")
873873
# End runCommand Example 2
874874

875875
def test_index_management(self):

test/unified-test-format/valid-pass/collectionData-createOptions.json

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,29 @@
4949
"description": "collection is created with the correct options",
5050
"operations": [
5151
{
52-
"name": "runCommand",
53-
"object": "database0",
52+
"object": "collection0",
53+
"name": "aggregate",
5454
"arguments": {
55-
"commandName": "collStats",
56-
"command": {
57-
"collStats": "coll0",
58-
"scale": 1
59-
}
55+
"pipeline": [
56+
{
57+
"$collStats": {
58+
"storageStats": {}
59+
}
60+
},
61+
{
62+
"$project": {
63+
"capped": "$storageStats.capped",
64+
"maxSize": "$storageStats.maxSize"
65+
}
66+
}
67+
]
6068
},
61-
"expectResult": {
62-
"capped": true,
63-
"maxSize": 4096
64-
}
69+
"expectResult": [
70+
{
71+
"capped": true,
72+
"maxSize": 4096
73+
}
74+
]
6575
}
6676
]
6777
}

0 commit comments

Comments
 (0)