I want to check compression ratio of my collection in Amazon DocumentDB, but when I run commands proposed in the docs https://docs.aws.amazon.com/documentdb/latest/developerguide/doc-compression.html :
db.printCollectionStats()
or db.collection.stats()
I get an error:
{ ok: 0, errmsg: "Aggregation stage not supported: '$collStats'" }
My cluster is using Engine version docdb 5.0.0
.
I tried to run above commands from mongosh
v 2.00 and NodeJS driver (mongodb
v6.0.0) and got the same results.
Based on Supported MongoDB APIs, Operations, and Data Types link provided in ray's answer I found out that $collStats
aggregation is not supported, but collStats
command is.
mongosh and Node driver are using $collStats
aggregation under the hood so it does not work with DocumentDB.
Instead, one need to invoke collStats
command directly on db with collection name in parameter.
Example in mongosh:
db.runCommand({collStats:"myCollection", scale:1000000})