File: collections.md

package info (click to toggle)
mongo-cxx-driver 4.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 13,832 kB
  • sloc: cpp: 61,365; python: 1,436; sh: 356; xml: 253; perl: 215; makefile: 21
file content (159 lines) | stat: -rw-r--r-- 4,021 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# Obtain a Collection

@snippet examples/api/mongocxx/examples/collections/obtain.cpp Example

# Collection Operations

## Drop a Collection

@snippet examples/api/mongocxx/examples/collections/drop.cpp Example

## Rename a Collection

@snippet examples/api/mongocxx/examples/collections/rename.cpp Example

## Set a Read Concern

@snippet examples/api/mongocxx/examples/collections/rc.cpp Example

## Set a Write Concern

@snippet examples/api/mongocxx/examples/collections/wc.cpp Example

## Set a Read Preference

@snippet examples/api/mongocxx/examples/collections/rp.cpp Example

# Index Operations

## On a Collection

### List Indexes

@snippet examples/api/mongocxx/examples/collections/list_indexes.cpp Example

### Create an Index

@snippet examples/api/mongocxx/examples/collections/create_index.cpp Example

### Create an Index With Options

@snippet examples/api/mongocxx/examples/collections/create_index_with_options.cpp Example

## With an Index View

### Obtain an Index View

@snippet examples/api/mongocxx/examples/collections/index_views/indexes.cpp Example

### List Indexes

@snippet examples/api/mongocxx/examples/collections/index_views/list.cpp Example

### Create an Index

@snippet examples/api/mongocxx/examples/collections/index_views/create.cpp Example

### Create an Index With Options

@snippet examples/api/mongocxx/examples/collections/index_views/create_with_options.cpp Example

### Create Multiple Indexes

@snippet examples/api/mongocxx/examples/collections/index_views/create_many.cpp Example

### Drop an Index

@snippet examples/api/mongocxx/examples/collections/index_views/drop.cpp Example

### Drop All Indexes

@snippet examples/api/mongocxx/examples/collections/index_views/drop_all.cpp Example

# Document Operations

## Query the Number of Documents

@snippet examples/api/mongocxx/examples/collections/count.cpp Example

## Estimate the Number of Documents

@snippet examples/api/mongocxx/examples/collections/estimate_count.cpp Example

## Find a Document

@snippet examples/api/mongocxx/examples/collections/find_one.cpp Example

## Find Multiple Documents

@snippet examples/api/mongocxx/examples/collections/find.cpp Example

## Delete a Document

@snippet examples/api/mongocxx/examples/collections/delete_one.cpp Example

## Delete Many Documents

@snippet examples/api/mongocxx/examples/collections/delete_many.cpp Example

## Insert a Document

@snippet examples/api/mongocxx/examples/collections/insert_one.cpp Example

## Insert Many Documents

@snippet examples/api/mongocxx/examples/collections/insert_many.cpp Example

## Replace a Document

@snippet examples/api/mongocxx/examples/collections/replace_one.cpp Example

## Update a Document

@snippet examples/api/mongocxx/examples/collections/update_one.cpp Example

## Update Multiple Documents

@snippet examples/api/mongocxx/examples/collections/update_many.cpp Example

## Find and Delete a Document

@snippet examples/api/mongocxx/examples/collections/find_one_and_delete.cpp Example

## Find and Replace a Document

@snippet examples/api/mongocxx/examples/collections/find_one_and_replace.cpp Example

## Find and Update a Document

@snippet examples/api/mongocxx/examples/collections/find_one_and_update.cpp Example

## Find Distinct Values

@snippet examples/api/mongocxx/examples/collections/distinct.cpp Example

## Execute a Single Bulk Write Operation

@snippet examples/api/mongocxx/examples/collections/write.cpp Example

## Execute Multiple Bulk Write Operations

@snippet examples/api/mongocxx/examples/collections/bulk_write.cpp Example

## Execute an Aggregation Operation

@snippet examples/api/mongocxx/examples/collections/aggregate.cpp Example

# Error Handling

## Invalid Collection

@snippet examples/api/mongocxx/examples/collections/incompatible_options.cpp Example

## Invalid Parameter

@snippet examples/api/mongocxx/examples/collections/invalid_parameter.cpp Example

## Incompatible Options

@snippet examples/api/mongocxx/examples/collections/incompatible_options.cpp Example