FindOneAndModifyOptions

  • Limits the fields to return for all matching documents.

    Declaration

    Swift

    public var projection: Document? { get set }
  • The order in which to return matching documents.

    Declaration

    Swift

    public var sort: Document? { get set }
  • Options to use when executing a findOneAndUpdate, findOneAndReplace, or findOneAndDelete command on a MongoCollection

    Declaration

    Swift

    public convenience init(_ projection: Document?,
                            _ sort: Document?,
                            _ upsert: Bool=false,
                            _ shouldReturnNewDocument: Bool=false)

    Parameters

    projection

    Limits the fields to return for all matching documents.

    sort

    The order in which to return matching documents.

    upsert

    Whether or not to perform an upsert, default is false (only available for findOneAndReplace and findOneAndUpdate)

    shouldReturnNewDocument

    When true then the new document is returned, Otherwise the old document is returned (default) (only available for findOneAndReplace and findOneAndUpdate)

  • Options to use when executing a findOneAndUpdate, findOneAndReplace, or findOneAndDelete command on a MongoCollection

    Declaration

    Swift

    public convenience init(projection: Document?,
                            sort: Document?,
                            upsert: Bool=false,
                            shouldReturnNewDocument: Bool=false)

    Parameters

    projection

    Limits the fields to return for all matching documents.

    sort

    The order in which to return matching documents.

    upsert

    Whether or not to perform an upsert, default is false (only available for findOneAndReplace and findOneAndUpdate)

    shouldReturnNewDocument

    When true then the new document is returned, Otherwise the old document is returned (default) (only available for findOneAndReplace and findOneAndUpdate)