...
Div | ||
---|---|---|
| ||
Name | Default Value | Description | Producer | Tailable Cursor Consumer |
---|---|---|---|---|
| none | Required. 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 | ||
| none | Required. 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 | ||
| none | Camel 2.12: An optional single field index or compound index to create when inserting new collections. |
| |
| none | Required for producers. The id of the operation this endpoint will execute. Pick from the following:
|
| |
| true | 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 |
| |
| false (behaviour may be inherited from connections WriteConcern) | Instructs the MongoDB Java driver to invoke |
| |
| none (driver's default) | Set a |
| |
| none | Sets a custom |
| |
| none | Available as of Camel 2.12.4, 2.13.1 and 2.14.0: Sets a ReadPreference on the connection. Accepted values are those supported by the ReadPreference#valueOf() public API. Currently as of MongoDB-Java-Driver version 2.12.0 the supported values are: |
| |
| false | If set to true, the endpoint will inspect the |
| |
| false | Available as of Camel 2.10.3 and 2.11: 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 |
| |
| false | Enables or disables persistent tail tracking for Tailable Cursor consumers. See below for more information. |
| |
| none | Required if persistent tail tracking is enabled. The id of this persistent tail tracker, to separate its records from the rest on the tail-tracking collection. |
| |
| none | Required if persistent tail tracking is enabled. 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. |
| |
| 1000ms | Establishes how long the endpoint will wait to regenerate the cursor after it has been killed by the MongoDB server (normal behaviour). |
| |
| same as endpoint's | Database on which the persistent tail tracker will store its runtime information. |
| |
| camelTailTracking | Collection on which the persistent tail tracker will store its runtime information. |
| |
| lastTrackingValue | Field in which the persistent tail tracker will store the last tracked value. |
|
...
Code Block |
---|
// 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);
|
From Camel 2.14 onwards you can provide a com.mongodb.DBObject
object in the message body as a query, and operation will return the amount of documents matching this criteria.
Code Block |
---|
DBObject query = ... Long count = template.requestBodyAndHeader("direct:count", query, MongoDbConstants.COLLECTION, "dynamicCollectionName"); |
getDbStats
Equivalent of running the db.stats()
command in the MongoDB shell, which displays useful statistic figures about the database.
For example:
...