From 3cd3fa57bcf3399d93542706a4a846b58ce2dda0 Mon Sep 17 00:00:00 2001 From: Isabella Siu Date: Mon, 22 Oct 2018 15:33:50 -0400 Subject: [PATCH] GODRIVER-280 remove maxScan query option Change-Id: I1ea0fa641ebf7b9fe5cce3e7fe30a2f29ea8f9df --- core/option/options.go | 19 ------------------- mongo/findopt/find.go | 10 ---------- mongo/findopt/findopt.go | 24 ------------------------ mongo/findopt/findopt_many_test.go | 1 - mongo/findopt/findopt_one_test.go | 1 - mongo/findopt/one.go | 10 ---------- 6 files changed, 65 deletions(-) diff --git a/core/option/options.go b/core/option/options.go index 173c330e03..84a08973c4 100644 --- a/core/option/options.go +++ b/core/option/options.go @@ -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) @@ -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) @@ -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 diff --git a/mongo/findopt/find.go b/mongo/findopt/find.go index fac0c4589c..765557201b 100644 --- a/mongo/findopt/find.go +++ b/mongo/findopt/find.go @@ -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{ diff --git a/mongo/findopt/findopt.go b/mongo/findopt/findopt.go index 0e2ff1713c..bf289c9a0b 100644 --- a/mongo/findopt/findopt.go +++ b/mongo/findopt/findopt.go @@ -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) @@ -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) @@ -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 { @@ -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 diff --git a/mongo/findopt/findopt_many_test.go b/mongo/findopt/findopt_many_test.go index 146549c087..4222e7b72d 100644 --- a/mongo/findopt/findopt_many_test.go +++ b/mongo/findopt/findopt_many_test.go @@ -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), diff --git a/mongo/findopt/findopt_one_test.go b/mongo/findopt/findopt_one_test.go index b55e1cdf2c..cef9a8ad18 100644 --- a/mongo/findopt/findopt_one_test.go +++ b/mongo/findopt/findopt_one_test.go @@ -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), diff --git a/mongo/findopt/one.go b/mongo/findopt/one.go index 3b60aa26db..b12780fd96 100644 --- a/mongo/findopt/one.go +++ b/mongo/findopt/one.go @@ -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{