MONGOC_MATCHER_T(3)
π MONGOC_MATCHER_T(3) π
okay bestie, welcome to libmongoc's little corner for mongoc_matcher_t β yes the manual name is literally libmongoc, she's the whole vibe π
β¨ NAME β¨
mongoc_matcher_t β mongoc_matcher_t
Client-side document matching abstraction πΈ
π¦ SYNOPSIS π¦
typedef struct _mongoc_matcher_t mongoc_matcher_t;
So mongoc_matcher_t is giving you a reduced-interface for matching BSON documents on the client side. like, you don't need the whole server for this, she's doing it herself π
She can do the basics, and by basics I mean: $in, $nin, $eq, $neq, $gt, $gte, $lt, and $lte. periodt.
β οΈ WARNING: mongoc_matcher_t does not currently support the full spectrum of query operations that the MongoDB server supports. so don't come for her about the fancy stuff, she said what she said π
π DEPRECATED π
β οΈ WARNING: mongoc_matcher_t is deprecated and will be removed in version 2.0. not me telling you to start planning the goodbye party rn π
π EXAMPLE π
Filter a sequence of BSON documents from STDIN based on a query π₯
#include <bson/bson.h>
#include <mongoc/mongoc.h>
#include <stdio.h>
int
main (int argc, char *argv[])
{
mongoc_matcher_t *matcher;
bson_reader_t *reader;
const bson_t *bson;
bson_t *spec;
char *str;
int fd;
mongoc_init ();
#ifdef _WIN32
fd = fileno (stdin);
#else
fd = STDIN_FILENO;
#endif
reader = bson_reader_new_from_fd (fd, false);
spec = BCON_NEW ("hello", "world");
matcher = mongoc_matcher_new (spec, NULL);
while ((bson = bson_reader_read (reader, NULL))) {
if (mongoc_matcher_match (matcher, bson)) {
str = bson_as_canonical_extended_json (bson, NULL);
printf ("%s\n", str);
bson_free (str);
}
}
bson_reader_destroy (reader);
bson_destroy (spec);
mongoc_cleanup ();
return 0;
}
like, she reads from STDIN, checks each doc against the spec, and prints the ones that ate π
π AUTHOR π
MongoDB, Inc π«Ά
π COPYRIGHT π
2017-present, MongoDB, Inc
and that's the whole page bestie β¨ this was version 1.23.1, dated Apr 27, 2026, and she's still serving MONGOC_MATCHER_T(3) energy π no cap, go write some matchers π§π
π¦ where this page comes from
- debian bookworm: libmongoc-doc 1.23.1-1+deb12u3 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms