Author: buildbot Date: Thu Oct 20 11:19:52 2016 New Revision: 999701 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 Thu Oct 20 11:19:52 2016 @@ -129,18 +129,18 @@ .to("mongodb:myDb?database=flights&collection=tickets&operation=findOneByQuery") .to("mock:resultFindOneByQuery"); ]]></script> -</div></div><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Supports fields filter</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>This operation supports specifying a fields filter. See <a shape="rect" href="#MongoDB-FieldsFilter">Specifying a fields filter</a>.</p></div></div><h4 id="MongoDB-findAll">findAll</h4><p>The <code>findAll</code> operation returns all documents matching a query, or none at all, in which case all documents contained in the collection are returned. <strong>The query object is extracted from the IN message body</strong>, i.e. it should be of type <code>DBObject</code> or convertible to <code>DBObject</code>. It can be a JSON String or a Hashmap. See <a shape="rect" href="#MongoDB-Typeconversions">#Type conversions</a> for more info.</p><p>Example with no query (returns all object in the collection):</p><div cla ss="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Supports fields filter</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>This operation supports specifying a fields filter. See <a shape="rect" href="#MongoDB-FieldsFilter">Specifying a fields filter</a>.</p></div></div><h4 id="MongoDB-findAll">findAll</h4><p>The <code>findAll</code> operation returns all documents matching a query. If your query is empty, all of the documents stored will match and be returned. <strong>The query object is extracted from the IN message body</strong>, i.e. it should be of type <code>DBObject</code> or convertible to <code>DBObject</code>. It can be a JSON String or a Hashmap. See <a shape="rect" href="#MongoDB-Typeconversions">#Type conversions</a> for more info.</p><p>Example with no query (returns all documents in the collection):</p><div class= "code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from("direct:findAll") .to("mongodb:myDb?database=flights&collection=tickets&operation=findAll") .to("mock:resultFindAll"); ]]></script> -</div></div><p>Example with a query (returns all matching results):</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>Example with a query (returns all matching documents):</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from("direct:findAll") .setBody().constant("{ \"name\": \"Raul Kripalani\" }") .to("mongodb:myDb?database=flights&collection=tickets&operation=findAll") .to("mock:resultFindAll"); ]]></script> -</div></div><p>Paging and efficient retrieval is supported via the following headers:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Header key</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Quick constant</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description (extracted from MongoDB API doc)</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Expected type</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelMongoDbNumToSkip</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MongoDbConstants.NUM_TO_SKIP</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Discards a given number of elements at the beginning of the cursor.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>int/Integer</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelMongoDbLimit</code></p></td><td colspan ="1" rowspan="1" class="confluenceTd"><p><code>MongoDbConstants.LIMIT</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Limits the number of elements returned.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>int/Integer</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelMongoDbBatchSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MongoDbConstants.BATCH_SIZE</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Limits the number of elements returned in one batch. A cursor typically fetches a batch of result objects and store them locally. If batchSize is positive, it represents the size of each batch of objects retrieved. It can be adjusted to optimize performance and limit data transfer. If batchSize is negative, it will limit of number objects returned, that fit within the max batch size limit (usually 4MB), and cursor will be closed. For example if batchSize is -10, then the server will return a maximum of 10 documents and as many as can fit in 4MB, then close the cursor. Note that this feature is different from limit() in that documents must fit within a maximum size, and it removes the need to send a request to close the cursor server-side. The batch size can be changed even after a cursor is iterated, in which case the setting will apply on the next batch retrieval.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>int/Integer</p></td></tr></tbody></table></div><p>Additionally, you can set a sortBy criteria by putting the relevant <code>DBObject</code> describing your sorting in the <code>CamelMongoDbSortBy</code> header, quick constant: <code>MongoDbConstants.SORT_BY</code>.</p><p>The <code>findAll</code> operation will also return the following OUT headers to enable you to iterate through result pages if you are using paging:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Header key</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Quick constant</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description (extracted from MongoDB API doc)</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Data type</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelMongoDbResultTotalSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MongoDbConstants.RESULT_TOTAL_SIZE</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Number of objects matching the query. This does not take limit/skip into consideration.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>int/Integer</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelMongoDbResultPageSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MongoDbConstants.RESULT_PAGE_SIZE</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Number of objects matc hing the query. This does not take limit/skip into consideration.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>int/Integer</p></td></tr></tbody></table></div><div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Supports fields filter</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><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-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"> +</div></div><p>Paging and efficient retrieval is supported via the following headers:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Header key</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Quick constant</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description (extracted from MongoDB API doc)</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Expected type</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelMongoDbNumToSkip</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MongoDbConstants.NUM_TO_SKIP</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Discards a given number of elements at the beginning of the cursor.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>int/Integer</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelMongoDbLimit</code></p></td><td colspan ="1" rowspan="1" class="confluenceTd"><p><code>MongoDbConstants.LIMIT</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Limits the number of elements returned.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>int/Integer</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelMongoDbBatchSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MongoDbConstants.BATCH_SIZE</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Limits the number of elements returned in one batch. A cursor typically fetches a batch of result objects and store them locally. If batchSize is positive, it represents the size of each batch of objects retrieved. It can be adjusted to optimize performance and limit data transfer. If batchSize is negative, it will limit of number objects returned, that fit within the max batch size limit (usually 4MB), and cursor will be closed. For example if batchSize is -10, then the server will return a maximum of 10 documents and as many as can fit in 4MB, then close the cursor. Note that this feature is different from limit() in that documents must fit within a maximum size, and it removes the need to send a request to close the cursor server-side. The batch size can be changed even after a cursor is iterated, in which case the setting will apply on the next batch retrieval.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>int/Integer</p></td></tr></tbody></table></div><p>You can also "<em>stream</em>" the documents returned from the server into your route by including <span><code>outputType=DBCursor</code> (Camel 2.16+) as an endpoint option which may prove simpler than setting the above headers. This hands your Exchange the DBCursor from the Mongo driver, just as if you were executing the <code>findAll()</code> within the Mongo shell, allowing your route to iterate over the results. By default and without this option, this component will load the documents from the driver's cursor into a List and return this to your route - which may result in a large number of in-memory objects. Remember, with a DBCursor do not ask for the number of documents matched - see the MongoDB documentation site for details.</span></p><p>Additionally, you can set a sortBy criteria by putting the relevant <code>DBObject</code> describing your sorting in the <code>CamelMongoDbSortBy</code> header, quick constant: <code>MongoDbConstants.SORT_BY</code>.</p><p>The <code>findAll</code> operation will also return the following OUT headers to enable you to iterate through result pages if you are using paging:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Header key</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Quick constant</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description (extracted from MongoDB API doc)</p></th><th colspan="1" rowspan="1" cl ass="confluenceTh"><p>Data type</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelMongoDbResultTotalSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MongoDbConstants.RESULT_TOTAL_SIZE</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Number of objects matching the query. This does not take limit/skip into consideration.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>int/Integer</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelMongoDbResultPageSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MongoDbConstants.RESULT_PAGE_SIZE</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Number of objects matching the query. This does not take limit/skip into consideration.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>int/Integer</p></td></tr></tbody></table></div><div class="confluence-information-macro confluence-info rmation-macro-tip"><p class="title">Supports fields filter</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><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-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="brush: java; gutter: false; theme: Default" 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);