Skip to content

Commit

Permalink
Add the missing find overload when decoding a Query: MongoKittenQue…
Browse files Browse the repository at this point in the history
…ry directly into a Decodable type (#338)
  • Loading branch information
Joannis committed Apr 7, 2024
1 parent db3f96e commit 1b249e7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Sources/MongoKitten/CollectionHelpers/Collection+Find.swift
Expand Up @@ -34,6 +34,13 @@ extension MongoCollection {
return find(query).decode(type)
}

/// Finds documents in this collection matching the given query. If no query is given, it returns all documents in the collection. Decodes the results to the given type.
/// - Parameter query: The query to match documents against
/// - Returns: A cursor to iterate over the results
public func find<D: Decodable, Query: MongoKittenQuery>(_ query: Query, as type: D.Type) -> MappedCursor<FindQueryBuilder, D> {
return find(query).decode(type)
}

/// Finds the first document in this collection matching the given query. Decodes the result into `D.Type`.
/// - Parameter query: The query to match documents against
/// - Parameter type: The type to decode the document to
Expand Down

0 comments on commit 1b249e7

Please sign in to comment.