Database
A Couchbase Lite database.
Constructors
Types
Properties
Functions
Adds a change listener for the changes that occur in the database, in the default collection.
Adds a change listener for the changes that occur in the database, in the default collection, with a CoroutineContext that will be used to launch coroutines the listener will be called on. Coroutines will be launched in a CoroutineScope that is canceled when the listener is removed.
Adds a change listener for the changes that occur in the database, in the default collection, with a CoroutineScope that will be used to launch coroutines the listener will be called on. The listener is removed when the scope is canceled.
Adds a change listener for the changes that occur to the specified document, in the default collection.
Adds a change listener for the changes that occur to the specified document, in the default collection, with a CoroutineContext that will be used to launch coroutines the listener will be called on. Coroutines will be launched in a CoroutineScope that is canceled when the listener is removed.
Adds a change listener for the changes that occur to the specified document, in the default collection, with a CoroutineScope that will be used to launch coroutines the listener will be called on. The listener is removed when the scope is canceled.
Create a named collection in the default scope. If the collection already exists, the existing collection will be returned.
Create a named collection in the specified scope. If the collection already exists, the existing collection will be returned.
Add an index to the default collection.
Create a SQL++ query.
A Flow of database changes.
Deletes a database. Deleting a database will stop all replicators, live queries and all listeners attached to it. Although attempting to close a closed database is not an error, attempting to delete a closed database is.
Deletes a document from the default collection. When write operations are executed concurrently, the last writer will overwrite all other written values. Calling this function is the same as calling delete(Document, ConcurrencyControl.LAST_WRITE_WINS)
Deletes a document from the default collection. When used with lastWriteWins concurrency control, the last write operation will win if there is a conflict. When used with FAIL_ON_CONFLICT concurrency control, delete will fail and the method will return false.
Delete a collection by name in the default scope. If the collection doesn't exist, the operation will be no-ops. Note: the default collection cannot be deleted.
Delete a collection by name in the specified scope. If the collection doesn't exist, the operation will be no-ops. Note: the default collection cannot be deleted.
Delete the named index from the default collection.
A Flow of document changes.
Gets document fragment object by the given document ID.
Get a collection in the default scope by name. If the collection doesn't exist, the function will return null.
Get a collection in the specified scope by name. If the collection doesn't exist, the function will return null.
Get all collections in the named scope.
Gets an existing Document with the given ID from the default collection. If the document with the given ID doesn't exist in the default collection, the method will return null. If the database is closed the method will throw an IllegalStateException.
Returns the expiration time of the document. If the document has no expiration time set, the method will return null.
Get a scope object by name. As the scope cannot exist by itself without having a collection, the null value will be returned if there are no collections under the given scope’s name. Note: The default scope is exceptional, and it will always be returned.
Runs a group of database operations in a batch. Use this when performing bulk write operations like multiple inserts/updates; it saves the overhead of multiple database commits, greatly improving performance.
Perform database maintenance.
Purges the passed document from the default collection. This is more drastic than delete(Document): it removes all local traces of the document. Purges will NOT be replicated to other databases.
Purges the document with the passed id from default collection. This is more drastic than delete(Document), it removes all local traces of the document. Purges will NOT be replicated to other databases.
Removes a change listener added to the default collection.
Saves a document to the default collection. When write operations are executed concurrently, the last writer will overwrite all other written values. Calling this method is the same as calling save(MutableDocument, ConcurrencyControl.LAST_WRITE_WINS)
Saves a document to the default collection. When used with LAST_WRITE_WINS concurrency control, the last write operation will win if there is a conflict. When used with FAIL_ON_CONFLICT concurrency control, save will fail when there is a conflict and the method will return false
Saves a document to the default collection. Conflicts will be resolved by the passed ConflictHandler
Sets an expiration date for a document in the default collection. The document will be purged from the database at the set time.