Structuremongokitten 7.9.5MongoKittenCore
Projection
A type respresents a MongoDB projection using a fluent syntax. This type is used as a parameter to the project
method on MongoCollection
.
struct Projection
Example:
let collection: MongoCollection = ...
let projection: Projection = [
"name": .included, // explicitly include the field "name"
]
Citizens in MongoKittenCore
Conformances
protocol Encodable
A type that can encode itself to an external representation.
protocol ExpressibleByDictionaryLiteral
A type that can be initialized using a dictionary literal.
Types
enum ProjectionExpression
An expression that can be specified to either include or exclude a field (or some custom value)
Type members
init(dictionaryLiteral: (FieldPath, ProjectionExpression)...
) init(document: Document
) static func allExcluding(Set<String>
) -> Projection static func subset(Set<String>, suppressingId: Bool
) -> Projection
Instance members
var document: Document
var minimalVersion: WireVersion?
func addLiteral(Primitive, at: FieldPath
) func encode(to: Encoder
) throws func exclude(FieldPath
) Excludes the field from the projection
func exclude(Set<FieldPath>
) Excludes the field from the projection
func include(FieldPath
) Includes the field in the projection
func include(Set<FieldPath>
) Includes the field in the projection
func moveRoot(to: FieldPath
) Makes the entire document available at a new location.
func projectElements(inArray: FieldPath, from: Int, count: Int
) func projectFirst(Int, forArray: FieldPath
) func projectFirstElement(forArray: FieldPath
) func projectLast(Int, forArray: FieldPath
) func rename(FieldPath, to: FieldPath
) Renames a field.