Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomas Voslar committed Apr 30, 2024
1 parent c8661eb commit 960f4a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,21 @@ interface IPaginateResult<T> {
}
```

### aggregatePaged()

`aggregatePaged()` will return ordered and paged results based on a field (`sortField`) that you pass in using MongoDB aggregate, which allows for more complicated queries compared to simple `findPaged()`.

### Parameters

Call `aggregatePaged()` with the following parameters:

- options {IPaginateOptions} (The paginate options)
- _pipeline {PipelineStage[]} (The aggregation pipeline array)

### Response

Same as for `findPaged()`

### Typegoose Model
Create your typegoose model as follows:

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Schema, PopulateOptions, PipelineStage, Collection, Model } from "mongoose";
import { Schema, PopulateOptions, PipelineStage, Model } from "mongoose";
import { generateAggregatePipeline, generateCursorQuery, generateSort } from "./query";
import { prepareResponse } from "./response";
import { IPaginateOptions, IPaginateResult, VerboseMode } from "./types";
Expand Down

0 comments on commit 960f4a0

Please sign in to comment.