1MONGOC_MATCHER_T(3)                libmongoc               MONGOC_MATCHER_T(3)
2
3
4

NAME

6       mongoc_matcher_t - mongoc_matcher_t
7
8       Client-side document matching abstraction
9

SYNOPSIS

11          typedef struct _mongoc_matcher_t mongoc_matcher_t;
12
13       mongoc_matcher_t  provides a reduced-interface for client-side matching
14       of BSON documents.
15
16       It can perform the basics such as $in, $nin, $eq, $neq, $gt, $gte, $lt,
17       and $lte.
18
19       WARNING:
20          mongoc_matcher_t  does  not  currently  support the full spectrum of
21          query operations that the MongoDB server supports.
22

DEPRECATED

24       WARNING:
25          mongoc_matcher_t is deprecated and will be removed in version 2.0.
26

EXAMPLE

28       Filter a sequence of BSON documents from STDIN based on a query
29
30          #include <bson/bson.h>
31          #include <mongoc/mongoc.h>
32          #include <stdio.h>
33
34          int
35          main (int argc, char *argv[])
36          {
37             mongoc_matcher_t *matcher;
38             bson_reader_t *reader;
39             const bson_t *bson;
40             bson_t *spec;
41             char *str;
42             int fd;
43
44             mongoc_init ();
45
46          #ifdef _WIN32
47             fd = fileno (stdin);
48          #else
49             fd = STDIN_FILENO;
50          #endif
51
52             reader = bson_reader_new_from_fd (fd, false);
53
54             spec = BCON_NEW ("hello", "world");
55             matcher = mongoc_matcher_new (spec, NULL);
56
57             while ((bson = bson_reader_read (reader, NULL))) {
58                if (mongoc_matcher_match (matcher, bson)) {
59                   str = bson_as_canonical_extended_json (bson, NULL);
60                   printf ("%s\n", str);
61                   bson_free (str);
62                }
63             }
64
65             bson_reader_destroy (reader);
66             bson_destroy (spec);
67
68             mongoc_cleanup ();
69
70             return 0;
71          }
72

AUTHOR

74       MongoDB, Inc
75
77       2017-present, MongoDB, Inc
78
79
80
81
821.20.0                           Nov 18, 2021              MONGOC_MATCHER_T(3)
Impressum