Finds a single events on the specified Stream that matches the specified options.
Octave.Event.findOne(streamId, options)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| streamId | String | Yes | The unique ID of the Stream. |
| options | Object | Yes | An optional object literal of query options: |
| options.filter | String | No | A filter string. |
| options.start | Integer | No | The start index of the search (default value is 0). |
| options.limit | Integer | No | The maximum response size (default value is 20). |
| options.sort | String | No | The string representation of the member key to sort the results over (default value is the creation date). |
| options.order | String | No | Specifies the sort order. Can be set to asc and desc (default value is desc). |
Returns
A JSON representation of a single matching Event.
Example
Request
//find the most recent events where x > 1:
var event = Octave.Event.findOne("s5b7c2258c4eaa25486be2ed1", {"filter": "x > 1", "sort":"creationDate"});
// event now contains the matching event
// event == {elems: { x:1 },creationDate: 1534865286261,...}
Response
// event now contains the matching event
{
elems:
{
x:1
},
creationDate: 1534865286261,
...
}
