Skip to content

Commit

Permalink
allow passing options to query function
Browse files Browse the repository at this point in the history
  • Loading branch information
heivo committed Mar 7, 2023
1 parent 013b7bd commit 2319cf4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,4 +420,6 @@ const container = new CosmosClient('').database('').container('');
const { query } = queryBuilder.select('id', 'mode', 'isConnected').build();
// resources is of type Pick<Machine, "id" | "mode" | "isConnected">[]
const { resources } = await query(container).fetchAll();
// you can also pass options that are forwarded to the container query function
const { resources } = await query(container, { maxItemCount: 100 }).fetchNext();
```
4 changes: 2 additions & 2 deletions src/CosmosQueryBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Container, SqlParameter, SqlQuerySpec, JSONValue } from '@azure/cosmos';
import type { Container, SqlParameter, SqlQuerySpec, JSONValue, FeedOptions } from '@azure/cosmos';
import { unpretty } from './helpers';
import type { ArrayElement, Path, PathValue } from './typeHelpers';

Expand Down Expand Up @@ -383,7 +383,7 @@ export class CosmosQueryBuilder<
querySpec,
conditionsExpression,
parameters,
query: (container: Container) => container.items.query<S>(querySpec),
query: (container: Container, options?: FeedOptions) => container.items.query<S>(querySpec, options),
};
}
}

0 comments on commit 2319cf4

Please sign in to comment.