Skip to content

Commit

Permalink
GODRIVER-280 remove maxScan query option
Browse files Browse the repository at this point in the history
Change-Id: I1ea0fa641ebf7b9fe5cce3e7fe30a2f29ea8f9df
  • Loading branch information
Isabella Siu committed Oct 24, 2018
1 parent fd9e1c0 commit 3cd3fa5
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 65 deletions.
19 changes: 0 additions & 19 deletions core/option/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ var (
_ FindOptioner = (*OptHint)(nil)
_ FindOptioner = (*OptLimit)(nil)
_ FindOptioner = (*OptMaxAwaitTime)(nil)
_ FindOptioner = (*OptMaxScan)(nil)
_ FindOptioner = (*OptMaxTime)(nil)
_ FindOptioner = (*OptMin)(nil)
_ FindOptioner = (*OptNoCursorTimeout)(nil)
Expand All @@ -244,7 +243,6 @@ var (
_ FindOneOptioner = (*OptComment)(nil)
_ FindOneOptioner = (*OptHint)(nil)
_ FindOneOptioner = (*OptMaxAwaitTime)(nil)
_ FindOneOptioner = (*OptMaxScan)(nil)
_ FindOneOptioner = (*OptMaxTime)(nil)
_ FindOneOptioner = (*OptMin)(nil)
_ FindOneOptioner = (*OptNoCursorTimeout)(nil)
Expand Down Expand Up @@ -597,23 +595,6 @@ func (opt OptMaxAwaitTime) String() string {
return "OptMaxAwaitTime: " + strconv.FormatInt(int64(opt), 10)
}

// OptMaxScan is for internal use.
type OptMaxScan int64

// Option implements the Optioner interface.
func (opt OptMaxScan) Option(d *bson.Document) error {
d.Append(bson.EC.Int64("maxScan", int64(opt)))
return nil
}

func (OptMaxScan) findOption() {}
func (OptMaxScan) findOneOption() {}

// String implements the Stringer interface.
func (opt OptMaxScan) String() string {
return "OptMaxScan: " + strconv.FormatInt(int64(opt), 10)
}

// OptMaxTime is for internal use.
type OptMaxTime time.Duration

Expand Down
10 changes: 0 additions & 10 deletions mongo/findopt/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,6 @@ func (fb *FindBundle) MaxAwaitTime(d time.Duration) *FindBundle {
return bundle
}

// MaxScan adds an option to specify the max number of documents or index keys to scan.
func (fb *FindBundle) MaxScan(i int64) *FindBundle {
bundle := &FindBundle{
option: MaxScan(i),
next: fb,
}

return bundle
}

// MaxTime adds an option to specify the max time to allow the query to run.
func (fb *FindBundle) MaxTime(d time.Duration) *FindBundle {
bundle := &FindBundle{
Expand Down
24 changes: 0 additions & 24 deletions mongo/findopt/findopt.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ var (
_ Find = (*OptLimit)(nil)
_ Find = (*OptMax)(nil)
_ Find = (*OptMaxAwaitTime)(nil)
_ Find = (*OptMaxScan)(nil)
_ Find = (*OptMaxTime)(nil)
_ Find = (*OptMin)(nil)
_ Find = (*OptNoCursorTimeout)(nil)
Expand All @@ -50,7 +49,6 @@ var (
_ One = (*OptHint)(nil)
_ One = (*OptMax)(nil)
_ One = (*OptMaxAwaitTime)(nil)
_ One = (*OptMaxScan)(nil)
_ One = (*OptMaxTime)(nil)
_ One = (*OptMin)(nil)
_ One = (*OptNoCursorTimeout)(nil)
Expand Down Expand Up @@ -149,12 +147,6 @@ func MaxAwaitTime(d time.Duration) OptMaxAwaitTime {
return OptMaxAwaitTime(d)
}

// MaxScan specifies the maximum number of documents or index keys to scan.
// Find, One
func MaxScan(i int64) OptMaxScan {
return OptMaxScan(i)
}

// MaxTime specifies the max time to allow the query to run.
// Find, One, DeleteOne, ReplaceOne, UpdateOne
func MaxTime(d time.Duration) OptMaxTime {
Expand Down Expand Up @@ -427,22 +419,6 @@ func (opt OptMaxAwaitTime) ConvertFindOneOption() option.FindOptioner {
return option.OptMaxAwaitTime(opt)
}

// OptMaxScan specifies the maximum number of documents or index keys to scan.
type OptMaxScan option.OptMaxScan

func (OptMaxScan) find() {}
func (OptMaxScan) one() {}

// ConvertFindOption implements the Find interface.
func (opt OptMaxScan) ConvertFindOption() option.FindOptioner {
return option.OptMaxScan(opt)
}

// ConvertFindOneOption implements the One interface.
func (opt OptMaxScan) ConvertFindOneOption() option.FindOptioner {
return option.OptMaxScan(opt)
}

// OptMaxTime specifies the max time to allow the query to run.
type OptMaxTime option.OptMaxTime

Expand Down
1 change: 0 additions & 1 deletion mongo/findopt/findopt_many_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ func TestFindOpt(t *testing.T) {
Limit(10),
Max("max for find"),
MaxAwaitTime(100),
MaxScan(1000),
MaxTime(5000),
Min("min for find"),
NoCursorTimeout(false),
Expand Down
1 change: 0 additions & 1 deletion mongo/findopt/findopt_one_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ func TestFindOneOpt(t *testing.T) {
Hint("hint for find"),
Max("max for find"),
MaxAwaitTime(100),
MaxScan(1000),
MaxTime(5000),
Min("min for find"),
NoCursorTimeout(false),
Expand Down
10 changes: 0 additions & 10 deletions mongo/findopt/one.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,6 @@ func (ob *OneBundle) MaxAwaitTime(d time.Duration) *OneBundle {
return bundle
}

// MaxScan adds an option to specify the number of documents or index keys to scan.
func (ob *OneBundle) MaxScan(i int64) *OneBundle {
bundle := &OneBundle{
option: MaxScan(i),
next: ob,
}

return bundle
}

// MaxTime adds an option to specify the max time to allow the query to run.
func (ob *OneBundle) MaxTime(d time.Duration) *OneBundle {
bundle := &OneBundle{
Expand Down

0 comments on commit 3cd3fa5

Please sign in to comment.