Skip to content

Commit d4819fc

Browse files
fix(server-provider-core): don't import MapReduceOptions from Node driver (#1383)
1 parent a825d14 commit d4819fc

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

packages/service-provider-core/src/all-transport-types.ts

-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ export type {
4646
ListCollectionsOptions,
4747
ListDatabasesOptions,
4848
ListIndexesOptions,
49-
MapReduceOptions,
5049
MongoClientOptions,
5150
OrderedBulkOperation,
5251
ReadConcern,

packages/service-provider-core/src/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import ShellAuthOptions from './shell-auth-options';
2626
export * from './all-transport-types';
2727
export * from './all-fle-types';
2828

29+
export { MapReduceOptions, FinalizeFunction } from './map-reduce-options';
30+
2931
const bson = {
3032
ObjectId,
3133
DBRef,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import type { CommandOperationOptions, Document, ObjectId, Sort } from 'mongodb';
2+
3+
export type FinalizeFunction<TKey = ObjectId, TValue = Document> = (
4+
key: TKey,
5+
reducedValue: TValue
6+
) => TValue;
7+
8+
export interface MapReduceOptions<TKey = ObjectId, TValue = Document>
9+
extends CommandOperationOptions {
10+
/** Sets the output target for the map reduce job. */
11+
out?: 'inline' | { inline: 1 } | { replace: string } | { merge: string } | { reduce: string };
12+
/** Query filter object. */
13+
query?: Document;
14+
/** Sorts the input objects using this key. Useful for optimization, like sorting by the emit key for fewer reduces. */
15+
sort?: Sort;
16+
/** Number of objects to return from collection. */
17+
limit?: number;
18+
/** Keep temporary data. */
19+
keeptemp?: boolean;
20+
/** Finalize function. */
21+
finalize?: FinalizeFunction<TKey, TValue> | string;
22+
/** Can pass in variables that can be access from map/reduce/finalize. */
23+
scope?: Document;
24+
/** It is possible to make the execution stay in JS. Provided in MongoDB \> 2.0.X. */
25+
jsMode?: boolean;
26+
/** Provide statistics on job execution time. */
27+
verbose?: boolean;
28+
/** Allow driver to bypass schema validation in MongoDB 3.2 or higher. */
29+
bypassDocumentValidation?: boolean;
30+
}

0 commit comments

Comments
 (0)