Skip to content

Commit ff1a218

Browse files
committed
Numeric ordering collation option
1 parent d2fc6c5 commit ff1a218

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

worker/sai-storage-mongo/external/adapter/types.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ type Request struct {
1919
}
2020

2121
type Options struct {
22-
Limit int64 `json:"limit"`
23-
Skip int64 `json:"skip"`
24-
Sort interface{} `json:"sort"`
25-
Count int64 `json:"count"`
22+
Limit int64 `json:"limit"`
23+
Skip int64 `json:"skip"`
24+
Sort interface{} `json:"sort"`
25+
Count int64 `json:"count"`
26+
NumericOrdering bool `json:"numeric_ordering"`
2627
}
2728

2829
func (r Request) GetMethod() string {

worker/sai-storage-mongo/mongo/client.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ func (c Client) Find(collectionName string, selector map[string]interface{}, inp
150150
requestOptions.SetProjection(projection)
151151
}
152152

153+
if inputOptions.NumericOrdering {
154+
requestOptions.Collation.NumericOrdering = true
155+
}
156+
153157
collection := c.GetCollection(collectionName)
154158
selector = c.preprocessSelector(selector)
155159

worker/sai-storage-mongo/types/mongo.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ type FindResult struct {
66
}
77

88
type Options struct {
9-
Limit int64 `json:"limit"`
10-
Skip int64 `json:"skip"`
11-
Sort interface{} `json:"sort"`
12-
Count int64 `json:"count"`
9+
Limit int64 `json:"limit"`
10+
Skip int64 `json:"skip"`
11+
Sort interface{} `json:"sort"`
12+
Count int64 `json:"count"`
13+
NumericOrdering bool `json:"numeric_ordering"`
1314
}

0 commit comments

Comments
 (0)