一个 MongoDB Atlas 数据 API 库,与所有 Apple 平台、Swift Cloud 和 Fastly Compute@Edge 兼容
import MongoDB
let client = MongoClient(
endpoint: "https://us-east-1.aws.data.mongodb-api.com/app/data-12345/endpoint/data/v1",
cluster: "cluster-prod",
database: "test",
apiKey: "..."
)
let user = try await client
.collection("users")
.send(.findOne())
.document(User.self)