Skip to content

Commit

Permalink
Remove optional check since Document omits the value if nil.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewangeta committed May 14, 2020
1 parent 7dc0765 commit 7955d40
Showing 1 changed file with 9 additions and 23 deletions.
32 changes: 9 additions & 23 deletions Sources/MongoKitten/AggregateStage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -242,33 +242,19 @@ public struct AggregateBuilderStage {
geoNear["near"] = ["type": "Point", "coordinates": coordinates] as Document
}

if let maxDistance = maxDistance {
geoNear["maxDistance"] = maxDistance
}

if let query = query {
geoNear["query"] = query
}

if let distanceMultiplier = distanceMultiplier {
geoNear["distanceMultiplier"] = distanceMultiplier
}
geoNear["maxDistance"] = maxDistance

geoNear["query"] = query

if let includeLocs = includeLocs {
geoNear["includeLocs"] = includeLocs
}
geoNear["distanceMultiplier"] = distanceMultiplier

geoNear["includeLocs"] = includeLocs

if let uniqueDocs = uniqueDocs {
geoNear["uniqueDocs"] = uniqueDocs
}
geoNear["uniqueDocs"] = uniqueDocs

if let minDistance = minDistance {
geoNear["minDistance"] = minDistance
}
geoNear["minDistance"] = minDistance

if let key = key {
geoNear["key"] = key
}
geoNear["key"] = key

return AggregateBuilderStage(document: [
"$geoNear": geoNear
Expand Down

0 comments on commit 7955d40

Please sign in to comment.