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

    @available(*, deprecated, message: "Use `sorting`")
    public var sort: Document? { get set }
  • The order in which to return matching documents, defined by SortDescriptor

    Declaration

    Swift

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

    Declaration

    Swift

    @available(*, deprecated, message: "Use init(projection:sorting:upsert:shouldReturnNewDocument:﹚")
    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?,
                            _ sorting: [Document] = [],
                            _ upsert: Bool=false,
                            _ shouldReturnNewDocument: Bool=false)

    Parameters

    projection

    Limits the fields to return for all matching documents.

    sorting

    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

    @available(*, deprecated, message: "Use init(projection:sorting:upsert:shouldReturnNewDocument:﹚")
    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)