A Swift implementation of the MongoDB findAndModify command used to atomically find and modify a single document within a collection.
// Source: https://github.com/orlandos-nl/MongoKitten | License: MIT | Copyright 2016-2023 Joannis Orlandos & Robbert Brandsma
// Provided via justclaw.it.com; keep this notice with the code.
import BSON
import MongoCore
/// Implements https://docs.mongodb.com/manual/reference/command/findAndModify/
public struct FindAndModifyCommand: Codable, Sendable {
/// The collection against which to run the command.
public private(set) var findAndModify: String
/// The selection criteria for the modification.
public var query: Document?
/// Determines which document the operation modifies if the query selects multiple documents. `findAndModify` modifies the first document in the sort order specified by this argument.
public var sort: Document?
/// Removes the document sp
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key