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

Conversation

lerouxb
Copy link
Contributor

@lerouxb lerouxb commented May 3, 2022

MongoDB 5.3 added support for clustered collections. Clustered collections are collections with a clustered index.

I based the changes in this PR off how timeseries collections work.

Scope: https://docs.google.com/document/d/1r_1BBIlfELnKBz5qAzzLDUB-BJfGrQKTS2TNHXu4DRg/edit#heading=h.b1os3ai9s8t3

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: <type>(NODE-xxxx)<!>: <description>
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

* @see https://www.mongodb.com/docs/v5.3/core/clustered-collections/
*/
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.

*/
export interface ClusteredCollectionOptions extends Document {
name?: string;
key: Document;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to the scope, key is required. But right now the only valid valid is { _id: 1 }

export interface ClusteredCollectionOptions extends Document {
name?: string;
key: Document;
unique: boolean;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to the scope, unique is required. But right now it has to be set to true.

@lerouxb
Copy link
Contributor Author

lerouxb commented May 3, 2022

I copied what's done for timeseries and didn't see that come up in any tests, so found no tests to implement. Maybe I just missed them. Please let me know if I should add any and where.

src/operations/indexes.ts Outdated Show resolved Hide resolved
@lerouxb
Copy link
Contributor Author

lerouxb commented May 4, 2022

Don't know what this error is:

[2022/05/04 10:42:33.890]   1 failing
[2022/05/04 10:42:33.890]   1) Server Operation Count Tests
[2022/05/04 10:42:33.890]        operationCount is adjusted properly on successful operation
[2022/05/04 10:42:33.890]          is zero after a successful getMore:
[2022/05/04 10:42:33.890]      MongoServerError: cursor id 949597150296799923 is already in use

@durran
Copy link
Member

durran commented May 4, 2022

#3229 (comment)

This error is unrelated.

src/operations/indexes.ts Outdated Show resolved Hide resolved
src/operations/create_collection.ts Show resolved Hide resolved
src/operations/create_collection.ts Outdated Show resolved Hide resolved
src/operations/create_collection.ts Outdated Show resolved Hide resolved
src/operations/create_collection.ts Outdated Show resolved Hide resolved
@baileympearson baileympearson added the Team Review Needs review from team label May 5, 2022
@baileympearson baileympearson merged commit 79a917b into mongodb:main May 5, 2022
@lerouxb lerouxb deleted the clustered-collections branch May 6, 2022 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team Review Needs review from team
Projects
None yet
3 participants