# Class: CollectionGroup

## CollectionGroup

#### new CollectionGroup()

Creates a new collection group. Collection groups allow single operations to be propagated to multiple collections at once. CRUD operations against a collection group are in fed to the group's collections. Useful when separating out slightly different data into multiple collections but querying as one collection.

Source:
  - CollectionGroup.js, line 18

### Methods

- drop() → {boolean}
- primaryKey(keyNameopt) → {*}
- removeById(id)
- subset(query, options) → {*}

#### drop() → {boolean}

Drops a collection group from the database.

Source:
  - CollectionGroup.js, line 263

##### Returns:

True on success, false on failure.

Type
  boolean

#### primaryKey(keyNameopt) → {*}

Gets / sets the primary key for this collection group.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`keyName` | String | <optional> | The name of the primary key.

Source:
  - CollectionGroup.js, line 60

##### Returns:

Type
  *

#### removeById(id)

Helper method that removes a document that matches the given id.

##### Parameters:

Name | Type | Description
--- | --- | ---
`id` | String | The id of the document to remove.

Source:
  - CollectionGroup.js, line 235

#### subset(query, options) → {*}

Uses the passed query to generate a new collection with results matching the query parameters.

##### Parameters:

Name | Type | Description
--- | --- | ---
`query` |  |
`options` |  |

Source:
  - CollectionGroup.js, line 250

##### Returns:

Type
  *