# Class: OCollector

## ink/collector~ OCollector

#### new OCollector()

  An object based collector

  Source:
    - documents/collector.js, line 251

### Extends

- module:documents/collector~CollectorBase

### Members

#### length :number

  Get the size of the collection

  ##### Type:

  - number
  Inherited From:
    - module:documents/collector~CollectorBase#length
  Source:
    - documents/collector.js, line 29

### Methods

#### all(qu) → {boolean}

  Returns true if all items match the query. Aliases as `every`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `qu` | object | The query to execute

  Inherited From:
    - module:documents/collector~CollectorBase#all
  Source:
    - documents/collector.js, line 411

  ##### Returns:

  Type
    boolean

#### any(qu) → {boolean}

  Returns true if any of the items match the query. Aliases as `all`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `qu` | object | The query to execute

  Inherited From:
    - module:documents/collector~CollectorBase#any
  Source:
    - documents/collector.js, line 422

  ##### Returns:

  Type
    boolean

#### every(qu) → {boolean}

  Returns true if all items match the query. Aliases as `all`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `qu` | object | The query to execute

  Inherited From:
    - module:documents/collector~CollectorBase#every
  Source:
    - documents/collector.js, line 379

  ##### Returns:

  Type
    boolean

#### find(qu) → {array}

  Find all records that match a query

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `qu` | object | The query to execute.

  Inherited From:
    - module:documents/collector~CollectorBase#find
  Source:
    - documents/collector.js, line 478

  ##### Returns:

  The results

  Type
    array

#### findKeys(qu) → {array}

  Find all records that match a query and returns the keys for those items. This is similar to module:ink/probe.find but instead of returning records, returns the keys. If `obj` is an object it will return the hash key. If 'obj' is an array, it will return the index

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `qu` | object | The query to execute.

  Inherited From:
    - module:documents/collector~CollectorBase#findKeys
  Source:
    - documents/collector.js, line 466

  ##### Returns:

  Type
    array

#### findOne(qu) → {object}

  Returns the first record that matches the query. Aliased as `seek`.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `qu` | object | The query to execute.

  Inherited From:
    - module:documents/collector~CollectorBase#findOne
  Source:
    - documents/collector.js, line 455

  ##### Returns:

  Type
    object

#### findOneKey(qu) → {object}

  Returns the first record that matches the query and returns its key or index depending on whether `obj` is an object or array respectively. Aliased as `seekKey`.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `qu` | object | The query to execute.

  Inherited From:
    - module:documents/collector~CollectorBase#findOneKey
  Source:
    - documents/collector.js, line 443

  ##### Returns:

  Type
    object

#### remove(qu) → {object|array}

  Remove all items in the object/array that match the query

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `qu` | object | The query to execute. See module:ink/probe.queryOperators for the operators you can use.

  Inherited From:
    - module:documents/collector~CollectorBase#remove
  Source:
    - documents/collector.js, line 433

  ##### Returns:

  The array or object as appropriate without the records.

  Type
    object | array

#### some(qu) → {boolean}

  Returns true if any of the items match the query. Aliases as `any`

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `qu` | object | The query to execute

  Inherited From:
    - module:documents/collector~CollectorBase#some
  Source:
    - documents/collector.js, line 390

  ##### Returns:

  Type
    boolean

#### unique(qu) → {array}

  Returns the set of unique records that match a query

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `qu` | object | The query to execute.

  Inherited From:
    - module:documents/collector~CollectorBase#unique
  Source:
    - documents/collector.js, line 401

  ##### Returns:

  Type
    array

#### update(qu, setDocument)

  Updates all records in obj that match the query. See module:ink/probe.updateOperators for the operators that are supported.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `qu` | object | The query which will be used to identify the records to updated
  `setDocument` | object | The update operator. See module:ink/probe.updateOperators

  Inherited From:
    - module:documents/collector~CollectorBase#update
  Source:
    - documents/collector.js, line 488