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

WARNING:

6          Deprecated  since  version  1.8.0:  This structure is deprecated and
7          should not be used in new code. See Manage Collection Indexes.
8
9

SYNOPSIS

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

DESCRIPTION

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

EXAMPLE

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

AUTHOR

77       MongoDB, Inc
78
80       2017-present, MongoDB, Inc
81
82
83
84
851.25.1                           Nov 08, 2023            MONGOC_INDEX_OPT_T(3)
Impressum