Apache CouchDB Query
You can use the Apache CouchDB Query activity to find a document from the database based on the input criteria.
Input Settings
The Input Settings tab has the following fields:
| Field | Description |
|---|---|
| Selector Expression | Provide a selector expression.
Sample selector expression: {"$or":
[
{
"year": {"$gt": "?year1"}
},
{
"year": {"$lt":"?year2"}
}
]
}
This sample shows a selector expression where the year is greater than year1 and is less than year2. If you consider 2001 as year1 and 2018 as year2 then the sample shows year greater than 2001 and less than 2018. |
| FieldName |
Select the type for each placeholder used in selector expression For example: STRING, NUMBER, BOOLEAN, JSON, ARRAY, and so on. |
Input
The Input tab contains the input schema. The fields that were selected on the Input Settings tab are available in the schema. You can either hard code their values or map them to a field from the output of a preceding activity in the flow by using the mapper.
the Input tab has the following fields:
| Field | Description |
|---|---|
| Selector | You must provide values for the placeholders from selector expression |
| Placeholders |
You must provide input value to the placeholders |
| Limit | You must provide maximum number of results returned. Default limit is 25. It is an optional field. |
| Skip | You must skip the first 'n' results, where 'n' is the value specified. It is an optional field. |
| Sort |
You must provide the JSON array following sort syntax. It is an optional field. |
| Fields | You must provide the JSON array specifying the fields of each document that should be returned. If it is omitted, the entire object is returned. It is an optional field. |
Output Settings
The Output Settings tab has the following field:
| Field | Description |
|---|---|
| Response Schema | Provide the CouchDB JSON schema.
Sample JSON schema:
{
"_id": "100063",
"_rev": "1-90d4068b3946fe809a9c9022f1e1c354",
"title": "The Love She Sought",
"year": 1990,
"rating": null,
"runtime": "100 min",
"genre":
[
"Drama"
],
"poster": "http://ia.media-imdb.com/images/M/MV5BMjEwODQzODc2Nl5BMl5BanBnXkFtZTgwMDY2ODk1MDE@._V1_SX300.jpg",
"imdb":
{
"rating": 7.9,
"votes": 747,
"id": "tt0100063"
}
}
|
Output
The Output tab displays the output schema of the activity as a tree structure. The output is read-only. The output (result set) varies based on the Fields selected on the Input tab. The properties that are displayed in the schema correspond to the output of this activity and can be used as input by subsequent activities in the flow.
