find()

Finds Events on the specified Stream which match the specified options.

Octave.Event.find(streamId, options)

Parameters

ParameterTypeRequiredDescription
streamIdStringYesThe unique ID of the Stream.
optionsObjectYesAn optional object literal of query options.
options.filterStringNoA filter string.
options.startIntegerNoThe start index of the search (default value is 0).
options.limitIntegerNoThe maximum response size (default value is 20).
options.sortStringNoString representation of the member key to sort the results over (default value is the creation date).
options.orderStringNoSpecifies the sort order. Can be set to asc and desc (default value is desc).

Returns

An array of JSON representations of the matching Events.

Request

//find the most recent 2 events where x > 1:
var events = Octave.Event.find("s5b7c2258c4eaa25486be2ed1", {"filter": "x > 1", "sort":"creationDate", "limit": 2});

Response

// events  now contains an array with matching values
[
  {
    elems:
   	{	
      x:1
    },
   	creationDate: 1534865286261,
    ...
  },
  {
    elems:
    {x:1},
  	....
	}
]