Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
duluca committed Dec 23, 2019
1 parent 09acf0a commit 1d7a077
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ A very thin TypeScript-based MongoDB helper with optional, rich ODM (Object Docu
## Major Features

- `connect()`
- connect()`

_MongoDB async connection harness_

Expand All @@ -24,8 +24,36 @@ A very thin TypeScript-based MongoDB helper with optional, rich ODM (Object Docu
_Base Class and Interface to help define your own models_
- `CollectionFactory`

_Define collections, organize indexes and aggregate queries alongside collection implementation_

_Define collections, organize indexes and aggregate queries alongside collection implementation. Below are the convenience features of a DocumentTS collection_
- `get collection` returns the navtive MongoDB collection, so you can directly operate on it
```js
get collection(): ICollectionProvider<TDocument>
```
- `aggregate` allows you run a MongoDB aggregation pipeline
```js
aggregate(pipeline: object[]): AggregationCursor<TDocument>
```
- `findOne` and `findOneAndUpdate` simplifies the operation of commonly used database functionality, automatically hydrating the models it returns
```js
async findOne(filter: FilterQuery<TDocument>, options?: FindOneOptions)
async findOneAndUpdate(
filter: FilterQuery<TDocument>,
update: TDocument | UpdateQuery<TDocument>,
options?: FindOneAndReplaceOption
): Promise<TDocument | null>
```
- `findWithPagination` is by far the best feature of DocumentTS, allowing you filter, sort, and paginate large collections of data. This function is geared towards use with data tables, so you specifies searchable properties, turn off hydration, and use a debug feature to fine tune your queries.
```js
async findWithPagination<TReturnType extends IDbRecord>(
queryParams: Partial<IQueryParameters> & object,
aggregationCursorFunc?: Func<AggregationCursor<TReturnType>>,
query?: string | object,
searchableProperties?: string[],
hydrate = true,
debugQuery = false
): Promise<IPaginationResult<TReturnType>>
```
## Quick Start

> Supports MongoDB v4+, Mongo Driver 3.3+ and TypeScript 3.7+
Expand Down

0 comments on commit 1d7a077

Please sign in to comment.