mongoc_matcher_t3
Mongoc_matcher_t client-side document matching abstraction
Usage
It can
perform
the
basics
such
as
$in,
$nin,
$eq,
$neq,
$gt,
$gte,
$lt,
and
$lte.
WARNING:
Deprecated
WARNING:
mongoc_matcher_t is deprecated and will be removed in version 2.0.
Examples
Filter a sequence of BSON documents from STDIN based on a query
#include <bson/bson.h>#include <mongoc/mongoc.h>#include <stdio.h>intmain (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 _WIN32fd = fileno (stdin);#elsefd = STDIN_FILENO;#endifreader = 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;}
History
- Debian 12 (Bookworm): the text shown here
- Debian 11 (Bullseye)
- Debian 10 (Buster)
- Debian 9 (Stretch)