You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CDRIVER-1526 Rewrite "_with_write_concern" functions to "_with_opts"
These function now take a generic bson_t options, which can contain
whichever options or arguments to the command.
To add write_concern to the these commands, add it to the generic opts
with:
mongoc_write_concern_append (wc, opts);
And pass opts to the function.
Removed
- mongoc_collection_aggregate_with_opts
- mongoc_database_create_collection_with_opts
Their respective function without _with_opts had opts parameter that
was retrofitted to support writeConcern and other arbitrary options
<tr><td><p>pipeline</p></td><td><p>A <codexref="bson:bson_t">bson_t</code> containing the pipeline array.</p></td></tr>
34
-
<tr><td><p>options</p></td><td><p>A <codexref="bson:bson_t">bson_t</code> containing options for the pipeline, or <code>NULL</code>.</p></td></tr>
35
+
<tr><td><p>opts</p></td><td><p>A <codexref="bson:bson_t">bson_t</code> containing options for the command, or <code>NULL</code>.</p></td></tr>
35
36
<tr><td><p>read_prefs</p></td><td><p>A <codexref="mongoc_read_prefs_t">mongoc_read_prefs_t</code> or <code>NULL</code>.</p></td></tr>
37
+
36
38
</table>
37
39
</section>
38
40
39
41
<sectionid="description">
40
42
<title>Description</title>
41
-
<p>For more information, see <codexref="mongoc_collection_aggregate_with_write_concern">mongoc_collection_aggregate_with_write_concern()</code>. This function is a thin wrapper, passing <code>NULL</code> in as <codexref="mongoc_write_concern_t">mongoc_write_concern_t</code> parameter.</p>
42
43
44
+
<p>This function shall execute an aggregation query on the underlying 'collection'. The bson 'pipeline' is not validated, simply passed along as appropriate to the server. As such, compatibility and errors should be validated in the appropriate server documentation.</p>
45
+
46
+
<p>In the case of older server versions, < v2.5, the returned cursor is a synthetic iterator over the result set. This provides a limitation insofar as returned documents can be no larger than 16MB. When connecting to newer servers this limitation doesn't exist. The specific test is for wire_version > 0.</p>
47
+
48
+
<p>For more information on building MongoDB pipelines, see <linkhref="http://docs.mongodb.org/manual/reference/command/aggregate/">MongoDB Aggregation Command</link> on the MongoDB website.</p>
49
+
<notestyle="info"><p>The <code>pipeline</code> parameter should contain a field named <code>pipeline</code> containing a BSON array of pipeline stages.</p></note>
50
+
<notestyle="tip"><p>The <codexref="mongoc_read_concern_t">mongoc_read_concern_t</code> and the <codexref="mongoc_write_concern_t">mongoc_write_concern_t</code> specified on the <codexref="mongoc_collection_t">mongoc_collection_t</code> will be used, if any.</p></note>
51
+
</section>
52
+
53
+
<sectionid="return">
54
+
<title>Returns</title>
55
+
<p>This function returns a newly allocated <codexref="mongoc_cursor_t">mongoc_cursor_t</code> that should be freed with <codexref="mongoc_cursor_destroy">mongoc_cursor_destroy()</code> when no longer in use. The returned <codexref="mongoc_cursor_t">mongoc_cursor_t</code> is never <code>NULL</code>; if the parameters are invalid, the <codexref="bson:bson_error_t">bson_error_t</code> in the <codexref="mongoc_cursor_t">mongoc_cursor_t</code> is filled out, and the <codexref="mongoc_cursor_t">mongoc_cursor_t</code> is returned before the server is selected.</p>
56
+
<notestyle="warning"><p>Failure to handle the result of this function is a programming error.</p></note>
<p>When using <code>$out</code>, the pipeline stage that writes, the write_concern field of the <codexref="mongoc_cursor_t">mongoc_cursor_t</code> will be set to the <codexref="mongoc_write_concern_t">mongoc_write_concern_t</code> parameter, if it is valid, and applied to the write command when <codexref="mongoc_cursor_next">mongoc_cursor_next()</code> is called. Pass any other parameters to the <code>aggregate</code> command, besides <code>pipeline</code>, as fields in <code>opts</code>:</p>
<p>For more information, see <codexref="mongoc_collection_create_index_with_write_concern">mongoc_collection_create_index_with_write_concern()</code>. This function is a thin wrapper, passing <code>NULL</code> in as <codexref="mongoc_write_concern_t">mongoc_write_concern_t</code> parameter. This function also creates a local <codexref="bson:bson_t">bson_t</code> to pass in as <code>reply</code> parameter, destroying it afterward.</p>
39
+
<p>For more information, see <codexref="mongoc_collection_create_index_with_opts">mongoc_collection_create_index_with_opts()</code>. This function is a thin wrapper, passing <code>NULL</code> in as <codexref="mongoc_write_concern_t">mongoc_write_concern_t</code> parameter. This function also creates a local <codexref="bson:bson_t">bson_t</code> to pass in as <code>reply</code> parameter, destroying it afterward.</p>
0 commit comments