Skip to content

fix(server-provider-core): don't import MapReduceOptions from Node driver #1383

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

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 0 additions & 1 deletion packages/service-provider-core/src/all-transport-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export type {
ListCollectionsOptions,
ListDatabasesOptions,
ListIndexesOptions,
MapReduceOptions,
MongoClientOptions,
OrderedBulkOperation,
ReadConcern,
Expand Down
2 changes: 2 additions & 0 deletions packages/service-provider-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import ShellAuthOptions from './shell-auth-options';
export * from './all-transport-types';
export * from './all-fle-types';

export { MapReduceOptions, FinalizeFunction } from './map-reduce-options';

const bson = {
ObjectId,
DBRef,
Expand Down
30 changes: 30 additions & 0 deletions packages/service-provider-core/src/map-reduce-options.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { CommandOperationOptions, Document, ObjectId, Sort } from 'mongodb';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { CommandOperationOptions, Document, ObjectId, Sort } from 'mongodb';
import type { CommandOperationOptions, Document, ObjectId, Sort } from 'mongodb';

(we don’t have a nice imports autoformatter like y’all do for the driver, but we do prefer import type where applicable)


export type FinalizeFunction<TKey = ObjectId, TValue = Document> = (
key: TKey,
reducedValue: TValue
) => TValue;

export interface MapReduceOptions<TKey = ObjectId, TValue = Document>
extends CommandOperationOptions {
/** Sets the output target for the map reduce job. */
out?: 'inline' | { inline: 1 } | { replace: string } | { merge: string } | { reduce: string };
/** Query filter object. */
query?: Document;
/** Sorts the input objects using this key. Useful for optimization, like sorting by the emit key for fewer reduces. */
sort?: Sort;
/** Number of objects to return from collection. */
limit?: number;
/** Keep temporary data. */
keeptemp?: boolean;
/** Finalize function. */
finalize?: FinalizeFunction<TKey, TValue> | string;
/** Can pass in variables that can be access from map/reduce/finalize. */
scope?: Document;
/** It is possible to make the execution stay in JS. Provided in MongoDB \> 2.0.X. */
jsMode?: boolean;
/** Provide statistics on job execution time. */
verbose?: boolean;
/** Allow driver to bypass schema validation in MongoDB 3.2 or higher. */
bypassDocumentValidation?: boolean;
}