Skip to content

Commit 258a560

Browse files
SWIFT-1225 Support let option in the aggregate command (#688)
1 parent 7312f62 commit 258a560

File tree

3 files changed

+660
-1
lines changed

3 files changed

+660
-1
lines changed

Sources/MongoSwift/Operations/AggregateOperation.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ public struct AggregateOptions: Codable {
3434
/// The index hint to use for the aggregation. The hint does not apply to $lookup and $graphLookup stages.
3535
public var hint: IndexHint?
3636

37+
/// The variables to use for the aggregation. Variables can be accessed in the aggregation command using the double
38+
/// dollar sign prefix in the form `$$<variable_name>`. This option is only available on MongoDB 5.0+.
39+
public var `let`: BSONDocument?
40+
3741
/// The maximum amount of time to allow the query to run.
3842
public var maxTimeMS: Int?
3943

@@ -56,6 +60,7 @@ public struct AggregateOptions: Codable {
5660
collation: BSONDocument? = nil,
5761
comment: String? = nil,
5862
hint: IndexHint? = nil,
63+
`let`: BSONDocument? = nil,
5964
maxTimeMS: Int? = nil,
6065
readConcern: ReadConcern? = nil,
6166
readPreference: ReadPreference? = nil,
@@ -67,6 +72,7 @@ public struct AggregateOptions: Codable {
6772
self.collation = collation
6873
self.comment = comment
6974
self.hint = hint
75+
self.let = `let`
7076
self.maxTimeMS = maxTimeMS
7177
self.readConcern = readConcern
7278
self.readPreference = readPreference
@@ -75,7 +81,7 @@ public struct AggregateOptions: Codable {
7581

7682
internal enum CodingKeys: String, CodingKey, CaseIterable {
7783
case allowDiskUse, batchSize, bypassDocumentValidation, collation, maxTimeMS, comment, hint, readConcern,
78-
writeConcern
84+
writeConcern, `let`
7985
}
8086
}
8187

0 commit comments

Comments
 (0)