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

AUTHOR

75       MongoDB, Inc
76
78       2017-present, MongoDB, Inc
79
80
81
82
831.16.2                           Feb 25, 2020              MONGOC_MATCHER_T(3)
Impressum