[Mongo Portable](../README.md) > [Selector](../classes/selector.md)

# Class: Selector

## Hierarchy

**Selector**

## Index

### Constructors

* [constructor](selector.md#constructor)

### Properties

* [clauses](selector.md#clauses)
* [logger](selector.md#logger)
* [selectorCompiled](selector.md#selectorcompiled)
* [AGG_FIELD_SELECTOR](selector.md#agg_field_selector)
* [FIELD_SELECTOR](selector.md#field_selector)
* [MATCH_SELECTOR](selector.md#match_selector)
* [SORT_SELECTOR](selector.md#sort_selector)

### Methods

* [___buildSelector](selector.md#___buildselector)
* [buildDocumentSelector](selector.md#builddocumentselector)
* [buildKeypathSelector](selector.md#buildkeypathselector)
* [compile](selector.md#compile)
* [compileFields](selector.md#compilefields)
* [compileSort](selector.md#compilesort)
* [createClause](selector.md#createclause)
* [test](selector.md#test)
* [isSelectorCompiled](selector.md#isselectorcompiled)
* [matches](selector.md#matches)

---

## Constructors

<a id="constructor"></a>

###  constructor

⊕ **new Selector**(selector: *`any`*, type?: *`string`*): [Selector](selector.md)

*Defined in [selector/Selector.ts:24](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L24)*

**Parameters:**

| Param | Type | Default value |
| ------ | ------ | ------ |
| selector | `any` | - |
| `Default value` type | `string` |  Selector.MATCH_SELECTOR |

**Returns:** [Selector](selector.md)

___

## Properties

<a id="clauses"></a>

###  clauses

**● clauses**: *`any`*

*Defined in [selector/Selector.ts:22](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L22)*

___
<a id="logger"></a>

### `<Protected>` logger

**● logger**: *`JSWLogger`*

*Defined in [selector/Selector.ts:24](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L24)*

___
<a id="selectorcompiled"></a>

###  selectorCompiled

**● selectorCompiled**: *`any`*

*Defined in [selector/Selector.ts:21](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L21)*

___
<a id="agg_field_selector"></a>

### `<Static>` AGG_FIELD_SELECTOR

**● AGG_FIELD_SELECTOR**: *`string`* = "project"

*Defined in [selector/Selector.ts:19](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L19)*

___
<a id="field_selector"></a>

### `<Static>` FIELD_SELECTOR

**● FIELD_SELECTOR**: *`string`* = "field"

*Defined in [selector/Selector.ts:18](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L18)*

___
<a id="match_selector"></a>

### `<Static>` MATCH_SELECTOR

**● MATCH_SELECTOR**: *`string`* = "match"

*Defined in [selector/Selector.ts:16](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L16)*

___
<a id="sort_selector"></a>

### `<Static>` SORT_SELECTOR

**● SORT_SELECTOR**: *`string`* = "sort"

*Defined in [selector/Selector.ts:17](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L17)*

___

## Methods

<a id="___buildselector"></a>

### `<Private>` ___buildSelector

▸ **___buildSelector**(selector: *`any`*): `any`[]

*Defined in [selector/Selector.ts:321](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L321)*

**Parameters:**

| Param | Type |
| ------ | ------ |
| selector | `any` |

**Returns:** `any`[]

___
<a id="builddocumentselector"></a>

### `<Private>` buildDocumentSelector

▸ **buildDocumentSelector**(key: *`any`*, value: *`any`*): [IClause](../interfaces/iclause.md)

*Defined in [selector/Selector.ts:343](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L343)*

**Parameters:**

| Param | Type |
| ------ | ------ |
| key | `any` |
| value | `any` |

**Returns:** [IClause](../interfaces/iclause.md)

___
<a id="buildkeypathselector"></a>

### `<Private>` buildKeypathSelector

▸ **buildKeypathSelector**(keypath: *`any`*, value: *`any`*): [IClause](../interfaces/iclause.md)

*Defined in [selector/Selector.ts:379](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L379)*

**Parameters:**

| Param | Type |
| ------ | ------ |
| keypath | `any` |
| value | `any` |

**Returns:** [IClause](../interfaces/iclause.md)

___
<a id="compile"></a>

###  compile

▸ **compile**(selector: *`any`*): [SelectorMatcher](selectormatcher.md)

*Defined in [selector/Selector.ts:48](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L48)*

**Parameters:**

| Param | Type |
| ------ | ------ |
| selector | `any` |

**Returns:** [SelectorMatcher](selectormatcher.md)

___
<a id="compilefields"></a>

###  compileFields

▸ **compileFields**(spec: *`any`*, aggregation: *`any`*): `any`

*Defined in [selector/Selector.ts:222](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L222)*

**Parameters:**

| Param | Type |
| ------ | ------ |
| spec | `any` |
| aggregation | `any` |

**Returns:** `any`

___
<a id="compilesort"></a>

###  compileSort

▸ **compileSort**(spec: *`any`*): `any`

*Defined in [selector/Selector.ts:100](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L100)*

**Parameters:**

| Param | Type |
| ------ | ------ |
| spec | `any` |

**Returns:** `any`

___
<a id="createclause"></a>

### `<Private>` createClause

▸ **createClause**(): [IClause](../interfaces/iclause.md)

*Defined in [selector/Selector.ts:312](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L312)*

**Returns:** [IClause](../interfaces/iclause.md)

___
<a id="test"></a>

###  test

▸ **test**(doc: *`any`*): `any`

*Defined in [selector/Selector.ts:44](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L44)*

**Parameters:**

| Param | Type |
| ------ | ------ |
| doc | `any` |

**Returns:** `any`

___
<a id="isselectorcompiled"></a>

### `<Static>` isSelectorCompiled

▸ **isSelectorCompiled**(selector: *`any`*): `boolean`

*Defined in [selector/Selector.ts:471](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L471)*

**Parameters:**

| Param | Type |
| ------ | ------ |
| selector | `any` |

**Returns:** `boolean`

___
<a id="matches"></a>

### `<Static>` matches

▸ **matches**(selector: *`any`*, doc: *`any`*): `any`

*Defined in [selector/Selector.ts:482](https://github.com/EastolfiWebDev/MongoPortable/blob/d5d3826/src/selector/Selector.ts#L482)*

**Parameters:**

| Param | Type |
| ------ | ------ |
| selector | `any` |
| doc | `any` |

**Returns:** `any`

___

