1MONGOC_INDEX_OPT_T(3)              libmongoc             MONGOC_INDEX_OPT_T(3)
2
3
4

NAME

6       mongoc_index_opt_t - mongoc_index_opt_t
7

SYNOPSIS

9          #include <mongoc/mongoc.h>
10
11          typedef struct {
12             bool is_initialized;
13             bool background;
14             bool unique;
15             const char *name;
16             bool drop_dups;
17             bool sparse;
18             int32_t expire_after_seconds;
19             int32_t v;
20             const bson_t *weights;
21             const char *default_language;
22             const char *language_override;
23             mongoc_index_opt_geo_t *geo_options;
24             mongoc_index_opt_storage_t *storage_options;
25             const bson_t *partial_filter_expression;
26             const bson_t *collation;
27             void *padding[4];
28          } mongoc_index_opt_t;
29

DEPRECATED

31       This  structure  is  deprecated and should not be used in new code. See
32       create-indexes.
33

DESCRIPTION

35       This structure contains the options that may be used for tuning a  spe‐
36       cific index.
37
38       See the createIndexes documentations in the MongoDB manual for descrip‐
39       tions of individual options.
40
41       NOTE:
42          dropDups is deprecated as of MongoDB version 3.0.0.  This option  is
43          silently  ignored  by  the server and unique index builds using this
44          option will fail if a duplicate value is detected.
45

EXAMPLE

47          {
48             bson_t keys;
49             bson_error_t error;
50             mongoc_index_opt_t opt;
51             mongoc_index_opt_geo_t geo_opt;
52
53             mongoc_index_opt_init (&opt);
54             mongoc_index_opt_geo_init (&geo_opt);
55
56             bson_init (&keys);
57             BSON_APPEND_UTF8 (&keys, "location", "2d");
58
59             geo_opt.twod_location_min = -123;
60             geo_opt.twod_location_max = +123;
61             geo_opt.twod_bits_precision = 30;
62             opt.geo_options = &geo_opt;
63
64             collection = mongoc_client_get_collection (client, "test", "geo_test");
65             if (mongoc_collection_create_index (collection, &keys, &opt, &error)) {
66                /* Successfully created the geo index */
67             }
68             bson_destroy (&keys);
69             mongoc_collection_destroy (&collection);
70          }
71

SEE ALSO

73       mongoc_index_opt_geo_t
74
75       mongoc_index_opt_wt_t
76

AUTHOR

78       MongoDB, Inc
79
81       2017-present, MongoDB, Inc
82
83
84
85
861.17.4                           Feb 04, 2021            MONGOC_INDEX_OPT_T(3)
Impressum