Skip to content

Commit f535036

Browse files
author
Christian Hergert
committed
doc: add create index docs
1 parent c0b5ff4 commit f535036

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mongoc_collection_ensure_index.txt

doc/mongoc_collection_ensure_index.txt

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@ mongoc_collection_ensure_index(3)
44

55
NAME
66
----
7-
mongoc_collection_ensure_index - Vivify an index on a collection
7+
mongoc_collection_create_index, mongoc_collection_ensure_index - Vivify an index on a collection
88

99

1010
SYNOPSIS
1111
--------
1212
[source,c]
1313
-----------------------
14+
bool
15+
mongoc_collection_create_index (mongoc_collection_t *collection,
16+
const bson_t *keys,
17+
const mongoc_index_opt_t *opt,
18+
bson_error_t *error);
19+
1420
bool
1521
mongoc_collection_ensure_index (mongoc_collection_t *collection,
1622
const bson_t *keys,
@@ -21,6 +27,26 @@ mongoc_collection_ensure_index (mongoc_collection_t *collection,
2127

2228
DESCRIPTION
2329
-----------
30+
31+
mongoc_collection_create_index
32+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33+
34+
The _mongoc_collection_create_index()_ function will request the creation of
35+
a new index.
36+
37+
This function will use the _createIndexes_ command if available on the
38+
MongoDB server. If not, it will fallback to inserting into system.indexes
39+
for compatibility with MongoDB <= 2.4.
40+
41+
See linkmongoc:mongoc_index_opt[7] for options on creating indexes.
42+
43+
44+
mongoc_collection_ensure_index
45+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46+
47+
This function is deprecated and should not be used in new code. Use
48+
_mongoc_collection_create_index()_ instead.
49+
2450
The _mongoc_collection_ensure_index()_ function requests that an index on
2551
'collection' be created if one does not already exist.
2652

0 commit comments

Comments
 (0)