Skip to content

GODRIVER-3522 Add support for the rawData option for time-series bucket access. #2159

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

qingyang-hu
Copy link
Collaborator

@qingyang-hu qingyang-hu commented Aug 5, 2025

GODRIVER-3522

Summary

Add support for the rawData option for time-series bucket access.

Background & Motivation

With PRs:
#2121
#2123
#2155

@alcaeus
Copy link
Member

alcaeus commented Aug 5, 2025

The pull-request-helpers failure is due to the branch being outdated compared to master. Merging in changes from master should solve this problem.

Copy link
Contributor

mongodb-drivers-pr-bot bot commented Aug 5, 2025

API Change Report

./v2/mongo/options

incompatible changes

BulkWriteOptions: old is comparable, new is not
ClientBulkWriteOptions: old is comparable, new is not
CountOptions: old is comparable, new is not
CreateIndexesOptions: old is comparable, new is not
DeleteManyOptions: old is comparable, new is not
DeleteOneOptions: old is comparable, new is not
DistinctOptions: old is comparable, new is not
DropIndexesOptions: old is comparable, new is not
EstimatedDocumentCountOptions: old is comparable, new is not
FindOneAndDeleteOptions: old is comparable, new is not
FindOneAndReplaceOptions: old is comparable, new is not
FindOneOptions: old is comparable, new is not
FindOptions: old is comparable, new is not
InsertManyOptions: old is comparable, new is not
InsertOneOptions: old is comparable, new is not
ListCollectionsOptions: old is comparable, new is not
ListIndexesOptions: old is comparable, new is not
ReplaceOptions: old is comparable, new is not

compatible changes

AggregateOptions.Internal: added
BulkWriteOptions.Internal: added
ClientBulkWriteOptions.Internal: added
CountOptions.Internal: added
CreateIndexesOptions.Internal: added
DeleteManyOptions.Internal: added
DeleteOneOptions.Internal: added
DistinctOptions.Internal: added
DropIndexesOptions.Internal: added
EstimatedDocumentCountOptions.Internal: added
FindOneAndDeleteOptions.Internal: added
FindOneAndReplaceOptions.Internal: added
FindOneAndUpdateOptions.Internal: added
FindOneOptions.Internal: added
FindOptions.Internal: added
InsertManyOptions.Internal: added
InsertOneOptions.Internal: added
ListCollectionsOptions.Internal: added
ListIndexesOptions.Internal: added
ReplaceOptions.Internal: added
UpdateManyOptions.Internal: added
UpdateOneOptions.Internal: added

./v2/x/mongo/driver/operation

compatible changes

(*Aggregate).RawData: added
(*Count).RawData: added
(*CreateIndexes).RawData: added
(*Delete).RawData: added
(*Distinct).RawData: added
(*DropIndexes).RawData: added
(*Find).RawData: added
(*FindAndModify).RawData: added
(*Insert).RawData: added
(*ListCollections).RawData: added
(*ListIndexes).RawData: added
(*Update).RawData: added

./v2/x/mongo/driver/xoptions

compatible changes

SetInternalAggregateOptions: added
SetInternalBulkWriteOptions: added
SetInternalClientBulkWriteOptions: added
SetInternalCountOptions: added
SetInternalCreateIndexesOptions: added
SetInternalDeleteManyOptions: added
SetInternalDeleteOneOptions: added
SetInternalDistinctOptions: added
SetInternalDropIndexesOptions: added
SetInternalEstimatedDocumentCountOptions: added
SetInternalFindOneAndDeleteOptions: added
SetInternalFindOneAndReplaceOptions: added
SetInternalFindOneAndUpdateOptions: added
SetInternalFindOneOptions: added
SetInternalFindOptions: added
SetInternalInsertManyOptions: added
SetInternalInsertOneOptions: added
SetInternalListCollectionsOptions: added
SetInternalListIndexesOptions: added
SetInternalReplaceOptions: added
SetInternalUpdateManyOptions: added
SetInternalUpdateOneOptions: added

@qingyang-hu qingyang-hu force-pushed the feature/godriver-3522-rawdata branch from 6c43dc5 to 77e93be Compare August 8, 2025 13:57
@qingyang-hu qingyang-hu force-pushed the feature/godriver-3522-rawdata branch from 77e93be to 5360234 Compare August 8, 2025 13:58
@qingyang-hu qingyang-hu marked this pull request as ready for review August 8, 2025 14:29
@Copilot Copilot AI review requested due to automatic review settings August 8, 2025 14:29
@qingyang-hu qingyang-hu requested a review from a team as a code owner August 8, 2025 14:29
@qingyang-hu qingyang-hu requested a review from matthewdale August 8, 2025 14:29
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Add support for the rawData option for time-series bucket access to MongoDB operations. This enables accessing time-series data in compressed format for MongoDB 8.2+ servers.

  • Adds rawData field to multiple operation structs and their corresponding command builders
  • Updates options structs to include Internal field for storing internal options like rawData
  • Implements version checking to only send rawData to MongoDB 8.2+ servers (wire version 27)

Reviewed Changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
x/mongo/driver/xoptions/options.go Added support functions for setting rawData internal option across multiple operation types
x/mongo/driver/xoptions/options_test.go Updated error messages to use quoted format for consistency
x/mongo/driver/operation/*.go Added rawData field and command support to various operations (update, insert, find, etc.)
mongo/options/*.go Added Internal field to options structs for storing internal configuration
mongo/*.go Updated operation execution to check for and apply rawData option from internal configuration
internal/integration/unified/*.go Added test support for rawData option in unified test framework

type DropIndexesOptions struct {
// Deprecated: This option is for internal use only and should not be set. It may be changed or removed in any
// release.
Internal optionsutil.Options
Copy link
Preview

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

[nitpick] The DropIndexesOptions struct change from an empty struct to one with an Internal field is inconsistent with the other changes in this file. Consider making this change in a separate commit to maintain clarity of the PR's purpose.

Suggested change
Internal optionsutil.Options

Copilot uses AI. Check for mistakes.

@@ -375,6 +386,13 @@ func (coll *Collection) InsertOne(ctx context.Context, document interface{},
if args.Comment != nil {
imOpts.SetComment(args.Comment)
}
if rawDataOpt := optionsutil.Value(args.Internal, "rawData"); rawDataOpt != nil {
imOpts.Opts = append(imOpts.Opts, func(opts *options.InsertManyOptions) error {
optionsutil.WithValue(opts.Internal, "rawData", rawDataOpt)
Copy link
Preview

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

The return value of optionsutil.WithValue is not being assigned back to opts.Internal. This should be opts.Internal = optionsutil.WithValue(opts.Internal, "rawData", rawDataOpt) to properly set the internal option.

Suggested change
optionsutil.WithValue(opts.Internal, "rawData", rawDataOpt)
opts.Internal = optionsutil.WithValue(opts.Internal, "rawData", rawDataOpt)

Copilot uses AI. Check for mistakes.

@@ -209,6 +210,10 @@ func (bw *bulkWrite) runInsert(ctx context.Context, batch bulkWriteBatch) (opera
}
op = op.Retry(retry)

if bw.rawData != nil {
op.RawData(*bw.rawData)
Copy link
Preview

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

The return value of op.RawData() is not being assigned back to op. This should be op = op.RawData(*bw.rawData) to properly chain the method call.

Suggested change
op.RawData(*bw.rawData)
op = op.RawData(*bw.rawData)

Copilot uses AI. Check for mistakes.

@@ -282,6 +287,10 @@ func (bw *bulkWrite) runDelete(ctx context.Context, batch bulkWriteBatch) (opera
}
op = op.Retry(retry)

if bw.rawData != nil {
op.RawData(*bw.rawData)
Copy link
Preview

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

The return value of op.RawData() is not being assigned back to op. This should be op = op.RawData(*bw.rawData) to properly chain the method call.

Suggested change
op.RawData(*bw.rawData)
op = op.RawData(*bw.rawData)

Copilot uses AI. Check for mistakes.

@@ -415,6 +424,10 @@ func (bw *bulkWrite) runUpdate(ctx context.Context, batch bulkWriteBatch) (opera
}
op = op.Retry(retry)

if bw.rawData != nil {
op.RawData(*bw.rawData)
Copy link
Preview

Copilot AI Aug 8, 2025

Choose a reason for hiding this comment

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

The return value of op.RawData() is not being assigned back to op. This should be op = op.RawData(*bw.rawData) to properly chain the method call.

Suggested change
op.RawData(*bw.rawData)
op = op.RawData(*bw.rawData)

Copilot uses AI. Check for mistakes.

@qingyang-hu qingyang-hu requested review from prestonvasquez and removed request for matthewdale August 8, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants