mongodb :: MongoCollection :: stats
Returns null
if an error occured. See Sys::last_mongoc_error
.
var client = new MongoClient("mongodb://mongo:27017/")
var db_suffix = "NIT_TESTING_ID".environ
var db_name = "test_{db_suffix}"
var db = client.database(db_name)
var col = db.collection("test")
assert col.stats["ns"] == "{db_name}.test"
# Retrieves statistics about the collection.
#
# Returns `null` if an error occured. See `Sys::last_mongoc_error`.
#
# ~~~
# var client = new MongoClient("mongodb://mongo:27017/")
# var db_suffix = "NIT_TESTING_ID".environ
# var db_name = "test_{db_suffix}"
# var db = client.database(db_name)
# var col = db.collection("test")
# assert col.stats["ns"] == "{db_name}.test"
# ~~~
fun stats: nullable JsonObject do
var bson = native.stats
if bson == null then return null
return new JsonObject.from_bson(new BSON(bson))
end
lib/mongodb/mongodb.nit:664,2--680,4