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
8       WARNING:
9          Deprecated  since  version  1.8.0:  This structure is deprecated and
10          should not be used in new code. See Manage Collection Indexes.
11
12

SYNOPSIS

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

DESCRIPTION

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

EXAMPLE

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

AUTHOR

80       MongoDB, Inc
81
83       2017-present, MongoDB, Inc
84
85
86
87
881.24.3                           Aug 17, 2023            MONGOC_INDEX_OPT_T(3)
Impressum