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

feat(NODE-4189): Support clustered collections #3229

Merged
merged 8 commits into from May 5, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/index.ts
Expand Up @@ -337,6 +337,7 @@ export type { IndexInformationOptions } from './operations/common_functions';
export type { CountOptions } from './operations/count';
export type { CountDocumentsOptions } from './operations/count_documents';
export type {
ClusteredCollectionOptions,
CreateCollectionOptions,
TimeSeriesCollectionOptions
} from './operations/create_collection';
Expand Down
15 changes: 14 additions & 1 deletion src/operations/create_collection.ts
Expand Up @@ -41,6 +41,17 @@ export interface TimeSeriesCollectionOptions extends Document {
granularity?: 'seconds' | 'minutes' | 'hours' | string;
}

/** @public
* Configuration options for clustered collections
* @see https://www.mongodb.com/docs/v5.3/core/clustered-collections/
lerouxb marked this conversation as resolved.
Show resolved Hide resolved
*/
export interface ClusteredCollectionOptions extends Document {
name?: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Name is optional and if left out the index will be named by the server automatically.

key?: Document;
lerouxb marked this conversation as resolved.
Show resolved Hide resolved
unique?: boolean;
lerouxb marked this conversation as resolved.
Show resolved Hide resolved
v?: string;
lerouxb marked this conversation as resolved.
Show resolved Hide resolved
}

/** @public */
export interface CreateCollectionOptions extends CommandOperationOptions {
/** Returns an error if the collection does not exist */
Expand Down Expand Up @@ -73,7 +84,9 @@ export interface CreateCollectionOptions extends CommandOperationOptions {
pkFactory?: PkFactory;
/** A document specifying configuration options for timeseries collections. */
timeseries?: TimeSeriesCollectionOptions;
/** The number of seconds after which a document in a timeseries collection expires. */
/** A document specifying configuration options for clustered collections. */
clusteredIndex?: ClusteredCollectionOptions;
lerouxb marked this conversation as resolved.
Show resolved Hide resolved
/** The number of seconds after which a document in a timeseries or clustered collection expires. */
expireAfterSeconds?: number;
}

Expand Down