Skip to content

PYTHON-3570 Deprecate currentOp/collStats commands by 7.0 #1205

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pymongo/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion test/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
}
Expand Down