Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: min and max take Document parameters, not numbers #2657

Merged
merged 1 commit into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/cursor/find_cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class FindCursor extends AbstractCursor {
*
* @param min - Specify a $min value to specify the inclusive lower bound for a specific index in order to constrain the results of find(). The $min specifies the lower bound for all keys of a specific index in order.
*/
min(min: number): this {
min(min: Document): this {
assertUninitialized(this);
this[kBuiltOptions].min = min;
return this;
Expand All @@ -182,7 +182,7 @@ export class FindCursor extends AbstractCursor {
*
* @param max - Specify a $max value to specify the exclusive upper bound for a specific index in order to constrain the results of find(). The $max specifies the upper bound for all keys of a specific index in order.
*/
max(max: number): this {
max(max: Document): this {
assertUninitialized(this);
this[kBuiltOptions].max = max;
return this;
Expand Down Expand Up @@ -242,15 +242,15 @@ export class FindCursor extends AbstractCursor {
break;

case 'max':
this[kBuiltOptions].max = value as number;
this[kBuiltOptions].max = value as Document;
break;

case 'maxTimeMS':
this[kBuiltOptions].maxTimeMS = value as number;
break;

case 'min':
this[kBuiltOptions].min = value as number;
this[kBuiltOptions].min = value as Document;
break;

case 'orderby':
Expand Down
8 changes: 4 additions & 4 deletions src/operations/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export interface FindOptions extends CommandOperationOptions {
batchSize?: number;
/** If true, returns only the index keys in the resulting documents. */
returnKey?: boolean;
/** Set index bounds. */
min?: number;
/** Set index bounds. */
max?: number;
/** The inclusive lower bound for a specific index */
min?: Document;
/** The exclusive upper bound for a specific index */
max?: Document;
/** You can put a $comment field on a query to make looking in the profiler logs simpler. */
comment?: string | Document;
/** Number of milliseconds to wait before aborting the query. */
Expand Down