https://github.com/mongorpc/mongorpc-swift
mongorpc client for swift
https://github.com/mongorpc/mongorpc-swift
database grpc mongodb mongorpc mongorpc-client swift sync
Last synced: 3 months ago
JSON representation
mongorpc client for swift
- Host: GitHub
- URL: https://github.com/mongorpc/mongorpc-swift
- Owner: mongorpc
- License: apache-2.0
- Created: 2021-10-28T05:50:48.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2026-01-05T13:09:37.000Z (3 months ago)
- Last Synced: 2026-01-13T19:51:25.681Z (3 months ago)
- Topics: database, grpc, mongodb, mongorpc, mongorpc-client, swift, sync
- Language: Swift
- Homepage:
- Size: 166 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# mongo-rpc-swift
Swift client for MongoRPC - a gRPC proxy for MongoDB.
## Installation
Add dependencies to your `Package.swift`:
```swift
dependencies: [
.package(url: "https://github.com/mongorpc/mongorpc-swift.git", branch: "main")
],
targets: [
.target(
name: "MyTarget",
dependencies: [
.product(name: "MongoRPC", package: "mongorpc-swift"),
]
)
]
```
## Quick Start
```swift
import MongoRPC
// Connect
let client = MongoRPC(host: "localhost", port: 50051)
let users = client.database("mydb").collection("users")
// Insert
let id = try await users.insertOne(["name": "Alice", "age": 30])
// Find by ID
if let doc = try await users.findById(id!) {
print(doc)
}
// Find with filter
let results = try await users.find(["age": ["$gte": 21]])
// Update
try await users.updateById(id!, update: ["$set": ["verified": true]])
// Delete
try await users.deleteById(id!)
```