Database Class |
Namespace: Couchbase.Lite
public sealed class Database : IDisposable
The Database type exposes the following members.
Name | Description | |
---|---|---|
Database |
Creates a database with a given name and database configuration. If the configuration
is null then the default configuration will be used. If the database does not yet
exist, it will be created.
|
Name | Description | |
---|---|---|
Config |
Gets the configuration that was used to create the database. The returned object
is readonly; an InvalidOperationException will be thrown if the configuration
object is modified.
| |
Count |
Gets the number of documents in the database
| |
Item |
Gets a DocumentFragment with the given document ID
| |
Name |
Gets the database's name
| |
Path |
Gets the database's path. If the database is closed or deleted, a null
value will be returned.
|
Name | Description | |
---|---|---|
AddChangeListener(EventHandlerDatabaseChangedEventArgs) |
Adds a change listener for the changes that occur in this database. Signatures
are the same as += style event handlers. The callback will be invoked on a thread pool
thread.
| |
AddChangeListener(TaskScheduler, EventHandlerDatabaseChangedEventArgs) |
Adds a change listener for the changes that occur in this database. Signatures
are the same as += style event handlers, but the callbacks will be called using the
specified TaskScheduler. If the scheduler is null, the default task
scheduler will be used (scheduled via thread pool).
| |
AddDocumentChangeListener(String, EventHandlerDocumentChangedEventArgs) |
Adds a document change listener for the document with the given ID. The callback will be
invoked on a thread pool thread.
| |
AddDocumentChangeListener(String, TaskScheduler, EventHandlerDocumentChangedEventArgs) |
Adds a document change listener for the document with the given ID and the TaskScheduler
that will be used to invoke the callback. If the scheduler is not specified, then the default scheduler
will be used (scheduled via thread pool)
| |
ChangeEncryptionKey | ENTERPRISE EDITION API Sets the encryption key for the database. If null, encryption is removed. | |
Close |
Closes the database
| |
Compact |
Compacts the database file by deleting unused attachment files and vacuuming
the SQLite database
| |
Copy |
Copies a canned database from the given path to a new database with the given name and
the configuration. The new database will be created at the directory specified in the
configuration. Without given the database configuration, the default configuration that
is equivalent to setting all properties in the configuration to null wlil be used.
| |
CreateIndex |
Creates an index which could be a value index from ValueIndex(IValueIndexItem) or a full-text search index
from FullTextIndex(IFullTextIndexItem) with the given name.
The name can be used for deleting the index. Creating a new different index with an existing
index name will replace the old index; creating the same index with the same name will be no-ops.
| |
Delete |
Deletes a database
| |
Delete(Document) |
Deletes a document from the database. When write operations are executed
concurrently, the last writer will overwrite all other written values.
Calling this method is the same as calling Delete(Document, ConcurrencyControl)
with LastWriteWins | |
Delete(String, String) |
Deletes a database of the given name in the given directory. If a null directory
is passed then the default directory is searched.
| |
Delete(Document, ConcurrencyControl) |
Deletes the given Document from this database
| |
DeleteIndex |
Deletes the index with the given name
| |
Dispose |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
| |
Equals | Determines whether the specified object is equal to the current object. (Overrides ObjectEquals(Object).) | |
Exists |
Checks whether a database of the given name exists in the given directory or not. If a
null directory is passed then the default directory is checked
| |
Finalize |
Finalizer
(Overrides ObjectFinalize.) | |
GetDocument |
Gets the Document with the specified ID
| |
GetHashCode | Serves as the default hash function. (Overrides ObjectGetHashCode.) | |
GetIndexes |
Gets a list of index names that are present in the database
| |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
InBatch |
Runs the given batch of operations as an atomic unit
| |
Purge |
Purges the given Document from the database. This leaves
no trace behind and will not be replicated
| |
RemoveChangeListener |
Removes a database changed listener by token
| |
Save(MutableDocument) |
Saves the given MutableDocument into this database. This call is equivalent to calling
Save(MutableDocument, ConcurrencyControl) with a second argument of
LastWriteWins | |
Save(MutableDocument, ConcurrencyControl) |
Saves the given MutableDocument into this database
| |
SetLogLevel |
Sets the log level for the given domains(s)
| |
ToString | Returns a string that represents the current object. (Overrides ObjectToString.) |