|
| 1 | +<?xml version="1.0"?> |
| 2 | +<page xmlns="http://projectmallard.org/1.0/" |
| 3 | + type="topic" |
| 4 | + style="function" |
| 5 | + xmlns:api="http://projectmallard.org/experimental/api/" |
| 6 | + xmlns:ui="http://projectmallard.org/experimental/ui/" |
| 7 | + id="mongoc_find_and_modify_opts_set_flags"> |
| 8 | + <info><link type="guide" xref="mongoc_find_and_modify_opts_t" group="function"/></info> |
| 9 | + <title>mongoc_find_and_modify_opts_set_flags()</title> |
| 10 | + |
| 11 | + <section id="synopsis"> |
| 12 | + <title>Synopsis</title> |
| 13 | + <synopsis><code mime="text/x-csrc"><![CDATA[bool |
| 14 | +mongoc_find_and_modify_opts_set_flags (mongoc_find_and_modify_opts_t *opts, |
| 15 | + const mongoc_find_and_modify_flags_t flags); |
| 16 | +]]></code></synopsis> |
| 17 | + <note style="tip"><p>New in mongoc 1.3.0</p></note> |
| 18 | + </section> |
| 19 | + |
| 20 | + <section id="parameters"> |
| 21 | + <title>Parameters</title> |
| 22 | + <table> |
| 23 | + <tr><td><p>opts</p></td><td><p>A <code xref="mongoc_find_and_modify_opts_t">mongoc_find_and_modify_opts_t</code>.</p></td></tr> |
| 24 | + <tr><td><p>flags</p></td><td><p>.</p></td></tr> |
| 25 | + </table> |
| 26 | + </section> |
| 27 | + |
| 28 | + <section id="description"> |
| 29 | + <title>Description</title> |
| 30 | + <p>Adds one or more flags to the builder.</p> |
| 31 | + <table> |
| 32 | + <tr><td><p>MONGOC_FIND_AND_MODIFY_NONE</p></td><td><p>Default. Doesn't add anything to the builder.</p></td></tr> |
| 33 | + <tr><td><p>MONGOC_FIND_AND_MODIFY_REMOVE</p></td><td><p>Will instruct find_and_modify to remove the matching document.</p></td></tr> |
| 34 | + <tr><td><p>MONGOC_FIND_AND_MODIFY_UPSERT</p></td><td><p>Update the matching document or, if no document matches, insert the document.</p></td></tr> |
| 35 | + <tr><td><p>MONGOC_FIND_AND_MODIFY_RETURN_NEW</p></td><td><p>Return the resulting document.</p></td></tr> |
| 36 | + </table> |
| 37 | + </section> |
| 38 | + |
| 39 | + |
| 40 | + <section id="return"> |
| 41 | + <title>Returns</title> |
| 42 | + <p>Returns true if it successfully added the option to the builder.</p> |
| 43 | + </section> |
| 44 | + |
| 45 | + <section id="example"> |
| 46 | + <title>Setting flags</title> |
| 47 | + <screen><code mime="text/x-csrc"><include parse="text" href="../examples/find_and_modify_with_opts/flags.c" xmlns="http://www.w3.org/2001/XInclude" /></code></screen> |
| 48 | + <p>Outputs:</p> |
| 49 | + <screen><code mime="text/x-csrc"><![CDATA[{ |
| 50 | + "lastErrorObject": { |
| 51 | + "updatedExisting": false, |
| 52 | + "n": 1, |
| 53 | + "upserted": { |
| 54 | + "$oid": "56562a99d13e6d86239c7b00" |
| 55 | + } |
| 56 | + }, |
| 57 | + "value": { |
| 58 | + "_id": { |
| 59 | + "$oid": "56562a99d13e6d86239c7b00" |
| 60 | + }, |
| 61 | + "age": 34, |
| 62 | + "firstname": "Zlatan", |
| 63 | + "goals": 342, |
| 64 | + "lastname": "Ibrahimovic", |
| 65 | + "profession": "Football player", |
| 66 | + "position": "striker" |
| 67 | + }, |
| 68 | + "ok": 1 |
| 69 | +}]]></code></screen> |
| 70 | + </section> |
| 71 | + |
| 72 | + |
| 73 | +</page> |
0 commit comments