Author: buildbot Date: Sun Feb 8 20:18:05 2015 New Revision: 939464 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/mongodb.html Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/camel/content/mongodb.html ============================================================================== --- websites/production/camel/content/mongodb.html (original) +++ websites/production/camel/content/mongodb.html Sun Feb 8 20:18:05 2015 @@ -96,7 +96,7 @@ </div></div><h2 id="MongoDB-URIformat">URI format</h2><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[mongodb:connectionBean?database=databaseName&collection=collectionName&operation=operationName[&moreOptions...] ]]></script> -</div></div><h2 id="MongoDB-Endpointoptions">Endpoint options</h2><p>MongoDB endpoints support the following options, depending on whether they are acting like a Producer or as a Consumer (options vary based on the consumer type too).</p><div class="confluenceTableSmall"> </div><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Producer</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Tailable Cursor Consumer</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>database</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required.</strong> The name of the database to which this endpoint will be bound. All operations will be executed against this database unless dynamicity is enabled and the <code>CamelMongoDbDatabase</code> header is set.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>collection</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required.</strong> The name of the collection (wit hin the specified database) to which this endpoint will be bound. All operations will be executed against this database unless dynamicity is enabled and the <code>CamelMongoDbDatabase</code> header is set.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>collectionIndex</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd">< p><strong>Camel 2.12:</strong> An optional <a shape="rect" class="external-link" href="http://docs.mongodb.org/manual/core/index-single/" rel="nofollow">single field index</a> or <a shape="rect" class="external-link" href="http://docs.mongodb.org/manual/core/index-compound/" rel="nofollow">compound index</a> to create when inserting new collections.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>operation</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required for producers.</strong> The id of the operation this endpoint wi ll execute. Pick from the following:</p><ul><li>Query operations: <code>findById</code>, <code>findOneByQuery</code>, <code>findAll</code>, <code>count</code></li><li>Write operations: <code>insert</code>, <code>save</code>, <code>update</code></li><li>Delete operations: <code>remove</code></li><li>Other operations: <code>getDbStats</code>, <code>getColStats</code>, <code>aggregate</code></li></ul></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>createCollection</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Determines whether the colle ction will be automatically created in the MongoDB database during endpoint initialisation if it doesn't exist already. If this option is <code>false</code> and the collection doesn't exist, an initialisation exception will be thrown.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>invokeGetLastError</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false (behaviour may be inherited from connections WriteConcern)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Instructs the MongoDB Java driver to invoke <code>getLastError()</code> after every call. Default behaviour in version 2.7.2 of t he MongoDB Java driver is that only network errors will cause the operation to fail, because the actual operation is executed asynchronously in the MongoDB server without holding up the client - to increase performance. The client can obtain the real result of the operation by explicitly invoking <code>getLastError()</code> on the <code>WriteResult</code> object returned or by setting the appropriate <code>WriteConcern</code>. If the backend operation has not finished yet, the client will block until the result is available. Setting this option to <code>true</code> will make the endpoint behave synchronously and return an Exception if the underlying operation failed.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class ="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>writeConcern</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none (driver's default)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Set a <code>WriteConcern</code> on the operation out of MongoDB's parameterised values. See <a shape="rect" class="external-link" href="http://api.mongodb.org/java/current/com/mongodb/WriteConcern.html#valueOf(java.lang.String)" rel="nofollow">WriteConcern.valueOf(String)</a>.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>writeConcernRef</code></p></td>< td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets a custom <code>WriteConcern</code> that exists in the Registry. Specify the bean name.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>readPreference</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Available as of Camel 2.12.4, 2.13.1 and 2.14.0:</strong> Sets a <a shape="rect" class="external-link" href="http://api.mongodb.org/java/current/com/mongodb/ReadPreference.html" rel="nofollow">ReadPreference</a> on the connection. Accepted values are those supported by the <a shape="rect" class="external-link" href="http://api.mongodb.org/java/current/com/mongodb/ReadPreference.html#valueOf(java.lang.String)" rel="nofollow">ReadPreference#valueOf()</a> public API. Currently as of MongoDB-Java-Driver version 2.12.0 the supported values are: <code>primary</code>, <code>primaryPreferred</code>, <code>secondary</code>, <code>secondaryPreferred</code> and <code>nearest</code>. See also the <a shape="rect" class="external-link" href="http://docs.mongodb.org/manual/core/read-preference/" rel="nofollow">documentation</a> for more details about this option.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </ p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>dynamicity</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If set to true, the endpoint will inspect the <code>CamelMongoDbDatabase</code> and <code>CamelMongoDbCollection</code> headers of the incoming message, and if any of them exists, the target collection and/or database will be overridden for that particular operation. Set to false by default to avoid triggering the lookup on every Exchange if the feature is not desired.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluen ceTd"><p><code>writeResultAsHeader</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Available as of Camel 2.10.3 and 2.11:</strong> In write operations (save, update, insert, etc.), instead of replacing the body with the WriteResult object returned by MongoDB, keep the input body untouched and place the WriteResult in the <code>CamelMongoWriteResult</code> header (constant <code>MongoDbConstants.WRITERESULT</code>).</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>persistentTailTracking</code></p></td><td colspan="1" rowspan=" 1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enables or disables persistent tail tracking for Tailable Cursor consumers. See below for more information.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>persistentId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required if persistent tail tracking is enabled.</strong> The id of this persistent tail tracker, to separate its records from the rest on the tail-tracking collection.</p></td><td colspan="1" rowspan="1" class="confluenc eTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackingIncreasingField</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required if persistent tail tracking is enabled.</strong> Correlation field in the incoming record which is of increasing nature and will be used to position the tailing cursor every time it is generated. The cursor will be (re)created with a query of type: tailTrackIncreasingField > lastValue (where lastValue is possibly recovered from persistent tail tracking). Can be of type Integer, Date, String, etc. NOTE: No support for dot notation at the curren t time, so the field should be at the top level of the document.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>cursorRegenerationDelay</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>1000ms</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Establishes how long the endpoint will wait to regenerate the cursor after it has been killed by the MongoDB server (normal behaviour).</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988 229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackDb</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>same as endpoint's</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Database on which the persistent tail tracker will store its runtime information.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackCollection</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>camelTailTracking</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Collection on which the persistent tail tracker will store its runtime information.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackField</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>lastTrackingValue</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Field in which the persistent tail tracker will store the last tracked value.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-19882 29788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr></tbody></table></div><h2 id="MongoDB-ConfigurationofdatabaseinSpringXML">Configuration of database in Spring XML</h2><p>The following Spring XML creates a bean defining the connection to a MongoDB instance.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h2 id="MongoDB-Endpointoptions">Endpoint options</h2><p>MongoDB endpoints support the following options, depending on whether they are acting like a Producer or as a Consumer (options vary based on the consumer type too).</p><div class="confluenceTableSmall"> </div><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Producer</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Tailable Cursor Consumer</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>database</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required.</strong> The name of the database to which this endpoint will be bound. All operations will be executed against this database unless dynamicity is enabled and the <code>CamelMongoDbDatabase</code> header is set.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>collection</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required (Except for <span>getDbStats and command operations)</span>.</strong> The name of the collection (within the specified database) to which this endpoint will be bound. All operations will be executed against this database unless dynamicity is enabled and the <code>CamelMongoDbDatabase</code> header is set.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>collectionIndex</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>non e</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> An optional <a shape="rect" class="external-link" href="http://docs.mongodb.org/manual/core/index-single/" rel="nofollow">single field index</a> or <a shape="rect" class="external-link" href="http://docs.mongodb.org/manual/core/index-compound/" rel="nofollow">compound index</a> to create when inserting new collections.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>operation</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required for producers.</strong> The id of the operation this endpoint will execute. Pick from the following:</p><ul><li>Query operations: <code>findById</code>, <code>findOneByQuery</code>, <code>findAll</code>, <code>count</code></li><li>Write operations: <code>insert</code>, <code>save</code>, <code>update</code></li><li>Delete operations: <code>remove</code></li><li>Other operations: <code>getDbStats</code>, <code>getColStats</code>, <code>aggregate,<span> </span>command</code></li></ul></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>createCollection</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>true</ p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Determines whether the collection will be automatically created in the MongoDB database during endpoint initialisation if it doesn't exist already. If this option is <code>false</code> and the collection doesn't exist, an initialisation exception will be thrown.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>invokeGetLastError</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false (behaviour may be inherited from connections WriteConcern)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Instructs the MongoDB Java driver to invok e <code>getLastError()</code> after every call. Default behaviour in version 2.7.2 of the MongoDB Java driver is that only network errors will cause the operation to fail, because the actual operation is executed asynchronously in the MongoDB server without holding up the client - to increase performance. The client can obtain the real result of the operation by explicitly invoking <code>getLastError()</code> on the <code>WriteResult</code> object returned or by setting the appropriate <code>WriteConcern</code>. If the backend operation has not finished yet, the client will block until the result is available. Setting this option to <code>true</code> will make the endpoint behave synchronously and return an Exception if the underlying operation failed.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check .png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>writeConcern</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none (driver's default)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Set a <code>WriteConcern</code> on the operation out of MongoDB's parameterised values. See <a shape="rect" class="external-link" href="http://api.mongodb.org/java/current/com/mongodb/WriteConcern.html#valueOf(java.lang.String)" rel="nofollow">WriteConcern.valueOf(String)</a>.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>writeConcernRef</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets a custom <code>WriteConcern</code> that exists in the Registry. Specify the bean name.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>readPreference</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Available as of Camel 2.12.4, 2.13.1 and 2.14.0:</strong> Sets a <a shape="rect" class="external-link" href="http://api.mongo db.org/java/current/com/mongodb/ReadPreference.html" rel="nofollow">ReadPreference</a> on the connection. Accepted values are those supported by the <a shape="rect" class="external-link" href="http://api.mongodb.org/java/current/com/mongodb/ReadPreference.html#valueOf(java.lang.String)" rel="nofollow">ReadPreference#valueOf()</a> public API. Currently as of MongoDB-Java-Driver version 2.12.0 the supported values are: <code>primary</code>, <code>primaryPreferred</code>, <code>secondary</code>, <code>secondaryPreferred</code> and <code>nearest</code>. See also the <a shape="rect" class="external-link" href="http://docs.mongodb.org/manual/core/read-preference/" rel="nofollow">documentation</a> for more details about this option.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="t ick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>dynamicity</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If set to true, the endpoint will inspect the <code>CamelMongoDbDatabase</code> and <code>CamelMongoDbCollection</code> headers of the incoming message, and if any of them exists, the target collection and/or database will be overridden for that particular operation. Set to false by default to avoid triggering the lookup on every Exchange if the feature is not desired.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" clas s="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>writeResultAsHeader</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Available as of Camel 2.10.3 and 2.11:</strong> In write operations (save, update, insert, etc.), instead of replacing the body with the WriteResult object returned by MongoDB, keep the input body untouched and place the WriteResult in the <code>CamelMongoWriteResult</code> header (constant <code>MongoDbConstants.WRITERESULT</code>).</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class= "confluenceTd"><p><code>persistentTailTracking</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enables or disables persistent tail tracking for Tailable Cursor consumers. See below for more information.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>persistentId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required if persistent tail tracking is enabled.</strong> The id of this persistent tail tracker, to separate its records from the res t on the tail-tracking collection.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackingIncreasingField</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required if persistent tail tracking is enabled.</strong> Correlation field in the incoming record which is of increasing nature and will be used to position the tailing cursor every time it is generated. The cursor will be (re)created with a query of type: tailTrackIncreasingField > lastValue (where lastValue is possibly recovered from persistent tail tracking). Can be of type Integer, Date, String, etc. NOTE: No support for dot notation at the current time, so the field should be at the top level of the document.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>cursorRegenerationDelay</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>1000ms</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Establishes how long the endpoint will wait to regenerate the cursor after it has been killed by the MongoDB server (normal behaviour).</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><i mg class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackDb</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>same as endpoint's</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Database on which the persistent tail tracker will store its runtime information.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackCollection</code></p></td><td col span="1" rowspan="1" class="confluenceTd"><p>camelTailTracking</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Collection on which the persistent tail tracker will store its runtime information.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackField</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>lastTrackingValue</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Field in which the persistent tail tracker will store the last tracked value.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><im g class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr></tbody></table></div><h2 id="MongoDB-ConfigurationofdatabaseinSpringXML">Configuration of database in Spring XML</h2><p>The following Spring XML creates a bean defining the connection to a MongoDB instance.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" @@ -161,7 +161,16 @@ <p>This operation supports specifying a fields filter. See <a shape="rect" href="#MongoDB-FieldsFilter">Specifying a fields filter</a>.</p> </div> </div> -<p><span class="confluence-anchor-link" id="MongoDB-FieldsFilter"></span></p><h4 id="MongoDB-Specifyingafieldsfilter">Specifying a fields filter</h4><p>Query operations will, by default, return the matching objects in their entirety (with all their fields). If your documents are large and you only require retrieving a subset of their fields, you can specify a field filter in all query operations, simply by setting the relevant <code>DBObject</code> (or type convertible to <code>DBObject</code>, such as a JSON String, Map, etc.) on the <code>CamelMongoDbFieldsFilter</code> header, constant shortcut: <code>MongoDbConstants.FIELDS_FILTER</code>.</p><p>Here is an example that uses MongoDB's BasicDBObjectBuilder to simplify the creation of DBObjects. It retrieves all fields except <code>_id</code> and <code>boringField</code>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<p><span class="confluence-anchor-link" id="MongoDB-FieldsFilter"></span></p><h4 id="MongoDB-count">count</h4><p>Returns the total number of objects in a collection, returning a Long as the OUT message body.<br clear="none">The following example will count the number of records in the "dynamicCollectionName" collection. Notice how dynamicity is enabled, and as a result, the operation will not run against the "notableScientists" collection, but against the "dynamicCollectionName" collection.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[// from("direct:count").to("mongodb:myDb?database=tickets&collection=flights&operation=count&dynamicity=true"); +Long result = template.requestBodyAndHeader("direct:count", "irrelevantBody", MongoDbConstants.COLLECTION, "dynamicCollectionName"); +assertTrue("Result is not of type Long", result instanceof Long); +]]></script> +</div></div><p>From <strong>Camel 2.14</strong> onwards you can provide a <code>com.mongodb.DBObject</code> object in the message body as a query,<span style="color: rgb(34,34,34);"> and operation will return the amount of documents matching this criteria. </span></p><p><span style="color: rgb(34,34,34);"> </span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[DBObject query = ... +Long count = template.requestBodyAndHeader("direct:count", query, MongoDbConstants.COLLECTION, "dynamicCollectionName"); +]]></script> +</div></div><h4 id="MongoDB-Specifyingafieldsfilter">Specifying a fields filter</h4><p>Query operations will, by default, return the matching objects in their entirety (with all their fields). If your documents are large and you only require retrieving a subset of their fields, you can specify a field filter in all query operations, simply by setting the relevant <code>DBObject</code> (or type convertible to <code>DBObject</code>, such as a JSON String, Map, etc.) on the <code>CamelMongoDbFieldsFilter</code> header, constant shortcut: <code>MongoDbConstants.FIELDS_FILTER</code>.</p><p>Here is an example that uses MongoDB's BasicDBObjectBuilder to simplify the creation of DBObjects. It retrieves all fields except <code>_id</code> and <code>boringField</code>:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[// route: from("direct:findAll").to("mongodb:myDb?database=flights&collection=tickets&operation=findAll") DBObject fieldFilter = BasicDBObjectBuilder.start().add("_id", 0).add("boringField", 0).get(); Object result = template.requestBodyAndHeader("direct:findAll", (Object) null, MongoDbConstants.FIELDS_FILTER, fieldFilter); @@ -192,16 +201,13 @@ Object result = template.requestBodyAndH DBObject conditionField = new BasicDBObject("conditionField", true); Object result = template.requestBody("direct:remove", conditionField); ]]></script> -</div></div><p>A header with key <code>CamelMongoDbRecordsAffected</code> is returned (<code>MongoDbConstants.RECORDS_AFFECTED</code> constant) with type <code>int</code>, containing the number of records deleted (copied from <code>WriteResult.getN()</code>).</p><h3 id="MongoDB-Otheroperations">Other operations</h3><h4 id="MongoDB-count">count</h4><p>Returns the total number of objects in a collection, returning a Long as the OUT message body.<br clear="none"> The following example will count the number of records in the "dynamicCollectionName" collection. Notice how dynamicity is enabled, and as a result, the operation will not run against the "notableScientists" collection, but against the "dynamicCollectionName" collection.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[// from("direct:count").to("mongodb:myDb?database=tickets&collection=flights&operation=count&dynamicity=true"); -Long result = template.requestBodyAndHeader("direct:count", "irrelevantBody", MongoDbConstants.COLLECTION, "dynamicCollectionName"); -assertTrue("Result is not of type Long", result instanceof Long); -]]></script> -</div></div><p>From <strong>Camel 2.14</strong> onwards you can provide a <code>com.mongodb.DBObject</code> object in the message body as a query,<span style="color: rgb(34,34,34);"> and operation will return the amount of documents matching this criteria. </span></p><p><span style="color: rgb(34,34,34);"> </span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[DBObject query = ... -Long count = template.requestBodyAndHeader("direct:count", query, MongoDbConstants.COLLECTION, "dynamicCollectionName"); -]]></script> -</div></div><h4 id="MongoDB-getDbStats">getDbStats</h4><p>Equivalent of running the <code>db.stats()</code> command in the MongoDB shell, which displays useful statistic figures about the database.<br clear="none"> For example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>A header with key <code>CamelMongoDbRecordsAffected</code> is returned (<code>MongoDbConstants.RECORDS_AFFECTED</code> constant) with type <code>int</code>, containing the number of records deleted (copied from <code>WriteResult.getN()</code>).</p><h3 id="MongoDB-Otheroperations">Other operations</h3><h4 id="MongoDB-aggregate"><span>aggregate</span></h4><h4 id="MongoDB-AvailableasofCamel2.14"><span style="line-height: 1.5;"><strong>Available as of Camel 2.14</strong></span></h4><p><span style="line-height: 1.5;">Perform a aggregation with the given pipeline contained in the body. <strong>Aggregations could be long and heavy operations. Use with care.</strong></span></p><p><span style="line-height: 1.5;"> </span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[// route: from("direct:aggregate").to("mongodb:myDb?database=science&collection=notableScientists&operation=aggregate"); +from("direct:aggregate") + .setBody().constant("[{ $match : {$or : [{\"scientist\" : \"Darwin\"},{\"scientist\" : \"Einstein\"}]}},{ $group: { _id: \"$scientist\", count: { $sum: 1 }} } ]") + .to("mongodb:myDb?database=science&collection=notableScientists&operation=aggregate") + .to("mock:resultAggregate");]]></script> +</div></div><h4 id="MongoDB-getDbStats"><span style="line-height: 1.5;">getDbStats</span></h4><p>Equivalent of running the <code>db.stats()</code> command in the MongoDB shell, which displays useful statistic figures about the database.<br clear="none"> For example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[> db.stats(); { "db" : "test", @@ -248,7 +254,11 @@ assertTrue("Result is not of type D Object result = template.requestBody("direct:getColStats", "irrelevantBody"); assertTrue("Result is not of type DBObject", result instanceof DBObject); ]]></script> -</div></div><p>The operation will return a data structure similar to the one displayed in the shell, in the form of a <code>DBObject</code> in the OUT message body.</p><h3 id="MongoDB-Dynamicoperations">Dynamic operations</h3><p>An Exchange can override the endpoint's fixed operation by setting the <code>CamelMongoDbOperation</code> header, defined by the <code>MongoDbConstants.OPERATION_HEADER</code> constant.<br clear="none"> The values supported are determined by the MongoDbOperation enumeration and match the accepted values for the <code>operation</code> parameter on the endpoint URI.</p><p>For example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>The operation will return a data structure similar to the one displayed in the shell, in the form of a <code>DBObject</code> in the OUT message body.</p><h4 id="MongoDB-command">command</h4><p><strong>Available as of Camel 2.15</strong></p><p>Run the body as a command on database. Usefull for admin operation as getting host informations, replication or sharding status.</p><p>Collection parameter is not use for this operation.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[// route: from("command").to("mongodb:myDb?database=science&operation=command"); +DBObject commandBody = new BasicDBObject("hostInfo", "1"); +Object result = template.requestBody("direct:command", commandBody);]]></script> +</div></div><h3 id="MongoDB-Dynamicoperations">Dynamic operations</h3><p>An Exchange can override the endpoint's fixed operation by setting the <code>CamelMongoDbOperation</code> header, defined by the <code>MongoDbConstants.OPERATION_HEADER</code> constant.<br clear="none"> The values supported are determined by the MongoDbOperation enumeration and match the accepted values for the <code>operation</code> parameter on the endpoint URI.</p><p>For example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[// from("direct:insert").to("mongodb:myDb?database=flights&collection=tickets&operation=insert"); Object result = template.requestBodyAndHeader("direct:insert", "irrelevantBody", MongoDbConstants.OPERATION_HEADER, "count"); assertTrue("Result is not of type Long", result instanceof Long);