MONGOC_COLLECTION_STATS(3)
π
MONGOC_COLLECTION_STATS(3) β the libmongoc page, but make it cute
okay bestie, sit down, hydrate, because we're talking about mongoc_collection_stats() β a lil function from the libmongoc manual, section 3. yes it's real, yes it's deprecated, and yes we're still gonna learn it because context is a love language π
β οΈ WARNING β this one is deprecated since version 1.10.0. the glow-up replacement is the$collStatsaggregation pipeline stage, used withmongoc_collection_aggregate(). so likeβ¦ use that instead, fr fr. π
β¨ SYNOPSIS β¨
bool
mongoc_collection_stats (mongoc_collection_t *collection,
const bson_t *options,
bson_t *reply,
bson_error_t *error);
that's the whole vibe. four arguments, one bool coming back at you. π«Ά
π PARAMETERS π
collectionβ amongoc_collection_t. your main character. the collection we're snooping on. πoptionsβ an optionalbson_tholding extra options you wanna pass along to thecollStatscommand. optional optional, no pressure, she's flexible. β¨replyβ a maybe-NULLpointer to overwritable storage for abson_tthat'll contain the results. "maybe-NULL" β so if you passNULL, that's a choice you're allowed to make, but bestieβ¦ π₯΄errorβ an optional place to put abson_error_t, orNULL. also optional. we love a low-stakes parameter list. π
πΈ DESCRIPTION πΈ
she runs the collStats command and retrieves statistics about the collection. that's the whole job. no cap. π
and the tea β: the command uses the mongoc_read_prefs_t that's set on collection. so whatever read prefs you gave her, that's what she rides with. not a surprise, just how it is. π
π ERRORS π
errors get propagated via the error parameter. that's it, that's the section. short and iconic. periodt. β¨
π₯ RETURNS π₯
- returns
trueif it worked. slay. π - returns
falseand setserrorif there are invalid arguments, or if there's a server error, or a network error. so many ways to have a bad day π
π«Ά IMPORTANT ONE:replyis always initialized and must be freed withbson_destroy(). always. even if things went sideways. don't leave her hanging, that's a leak and leaks are not cute. π
π§ AUTHOR π§
MongoDB, Inc
β COPYRIGHT β
2009-present, MongoDB, Inc.
okay that's the whole page, you ate that, you're basically a database girlie now π go forth and (please) use $collStats with mongoc_collection_aggregate() instead, because this function is deprecated and we don't stan deprecated APIs in this house ππ¦
this has been the libmongoc MONGOC_COLLECTION_STATS(3) page, version 1.30.13, dated Oct 09, 2026 β mwah, bye bestie! πΈππ
π¦ where this page comes from
- fedora 43: mongo-c-driver-devel 1.30.13-1.fc43 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- fedora 43: mongo-c-driver-devel 1.30.13-1.fc43 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms