Couchbase Mobile securely syncs data from any cloud to the edge, enabling you to store, query, search, and analyze data in the cloud, at the edge, or on the device regardless of internet connectivity and speed, guaranteeing that applications are always fast and always on.
The latest release strengthens our support for edge computing by expanding our edge device platform support for C, Kotlin, and SQL++ in addition to secure Sync Gateway admin over the web.
See What's NewLearn how you can quickly add the Couchbase Lite SDK to your mobile app and enable features like query, indexes, and data sync.
View Learning PathsiOS / Swift
.NET / C#
Android / Kotlin
C
// Create or open a database
let database: Database
do {
database = try Database(name: "mydb")
} catch {
fatalError("Error opening database")
}
// Create a new document (i.e. a record) in the database.
let mutableDoc = MutableDocument()
.setFloat(2.0, forKey: "version")
.setString("SDK", forKey: "type")
// Save it to the database.
do {
try database.saveDocument(mutableDoc)
} catch {
fatalError("Error saving document")
}
// Update a document.
if let mutableDoc = database
.document(withID: mutableDoc.id)
?.toMutable() {
mutableDoc.setString("Swift", forKey: "language")
do {
try database.saveDocument(mutableDoc)
let document = database.document(withID: mutableDoc.id)!
} catch {
fatalError("Error updating document")
}
}
// Create a query to fetch documents of type SDK.
let query = QueryBuilder
.select(SelectResult.all())
.from(DataSource.database(database))
.where(Expression.property("type").equalTo(Expression.string("SDK")))
// Run the query.
do {
let result = try query.execute()
print("Number of rows :: \(result.allResults().count)")
} catch {
fatalError("Error running the query")
}
// Create replicators to push and pull changes to and from the cloud.
let targetEndpoint =
URLEndpoint(url: URL(string: "ws://localhost:4984/getting-started-db")!)
var replConfig = ReplicatorConfiguration(database: database, target: targetEndpoint)
replConfig.replicatorType = .pushAndPull
// Add authentication.
replConfig.authenticator = BasicAuthenticator(username: "john", password: "pass")
// Create replicator
// (make sure to add an instance or static variable named replicator)
let replicator = Replicator(config: replConfig)
// Optionally,Listen to replicator change events.
replicator.addChangeListener { (change) in
if let error = change.status.error as NSError? {
print("Error code :: \(error.code)")
}
}
// Start replication.
replicator.start()
Couchbase Mobile is developer-friendly and can run anywhere – in the cloud, at the edge, and directly on mobile and edge devices – with automatic synchronization to ensure low latency, data integrity, and high availability for applications. It's a complete NoSQL database solution for all data storage, access, sync, and security from the cloud to the edge to the device.
Couchbase Lite, our embedded database, manages and stores data locally on the device. It has full CRUD and SQL++ query functionality, and supports all major platforms including iOS, OS X, tvOS, Android, Linux, Windows, Xamarin, Kotlin, Ionic, and more.
Couchbase Mobile includes synchronization between Couchbase Lite and Couchbase Server, and peer-to-peer synchronization between Couchbase Lite instances. Synchronization is orchestrated by Sync Gateway, our secure gateway.
Couchbase Server, our database server, manages and stores data in the cloud. It scales easily to billions of records and terabytes of data, supports millions of concurrent users, and provides 24x365 uptime.
Couchbase Mobile allows you to build amazing products and solutions using the platforms and languages you love.
Learn how Couchbase Mobile can help you build robust applications in Swift or Objective-C with offline capabilities that can sync data from the cloud or your data center.
Learn how Couchbase Mobile can help you build robust Android applications in Kotlin or Java with offline capabilities that can sync data from the cloud or your data center
Learn how Couchbase Mobile can help you build robust .NET applications in C# with offline capabilities that can sync data from the cloud or your data center.
Learn to build and operate apps using Couchbase.
Couchbase Mobile is developer-friendly and can run anywhere – in the cloud, at the edge, and directly on mobile and edge devices – with automatic synchronization to ensure low latency, data integrity, and high availability for applications. It's a complete NoSQL database solution for all data storage, access, sync, and security from the cloud to the edge to the device.
Enabling customer success with the world’s most powerful NoSQL database.
Blog posts about Couchbase Mobile, embedded databases, IoT, and Edge Computing.
Couchbase Mobile, Sync Gateway, and Couchbase Server SDK, API, and infrastructure documentation.