class Database extends DocumentOps
Gives the user access to the different operations available on a database. Among other operations this is the key class to get access to the documents of this database.
It also exposes the change handler interface, that allows people to react to change notifications. This is a low-level API, that handles raw Json objects
- Grouped
- Alphabetic
- By Inheritance
- Database
- DocumentOps
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
allDocs(key: Option[String] = None, keys: Iterable[String] = Nil, startkey: Option[String] = None, startkey_docid: Option[String] = None, endkey: Option[String] = None, endkey_docid: Option[String] = None, limit: Int = 1, stale: Option[String] = None, descending: Boolean = false, skip: Int = 0, inclusive_end: Boolean = true): Future[List[String]]
Returns the list of identifiers of the documents in this database
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
attachTo(docId: String, attachment: String, stream: InputStream, contentType: String): Future[Boolean]
Attaches the given file (given as an input stream) to the given document id.
Attaches the given file (given as an input stream) to the given document id. If no mime type is given, sohva tries to guess the mime type of the file itself. It it does not manage to identify the mime type, the file won't be attached... This method returns
true
iff the file was attached to the document. -
def
attachTo(docId: String, file: File, contentType: String): Future[Boolean]
Attaches the given file to the given document id.
Attaches the given file to the given document id. This method returns
true
iff the file was attached to the document. -
def
builtInView(view: String): View
Returns a built-in view of this database, identified by its name.
Returns a built-in view of this database, identified by its name. E.g.
_all_docs
. -
def
bulkDocs[T](operations: Iterable[BulkOp[T]])(implicit arg0: CouchFormat[T]): Future[List[DbResult]]
Performs bulk document update.
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
compact: Future[Boolean]
Requests a database compaction.
-
def
copy(origin: String, target: String, originRev: Option[String] = None, targetRev: Option[String] = None): Future[Boolean]
Copies the origin document to the target document.
Copies the origin document to the target document. If the target does not exist, it is created, otherwise it is updated and the target revision must be provided
- val couch: CouchDB
-
def
create: Future[Boolean]
Creates this database in the couchdb instance if it does not already exist.
Creates this database in the couchdb instance if it does not already exist. Returns
true
iff the database was actually created. -
def
createDoc[T](doc: T)(implicit arg0: JsonWriter[T]): Future[DbResult]
Creates a document in the database and returns its identifier and revision.
Creates a document in the database and returns its identifier and revision. If the json version of the object has a
_id
field, this identifier is used for the document, otherwise a new one is generated. -
def
createDocs[T](docs: Iterable[T])(implicit arg0: JsonWriter[T]): Future[List[DbResult]]
Creates a set of documents in the database and returns theirs identifiers and revision.
Creates a set of documents in the database and returns theirs identifiers and revision. If the json version of an object has a
_id
field, this identifier is used for the document, otherwise a new one is generated. -
val
credit: Int
- Definition Classes
- Database → DocumentOps
-
def
delete: Future[Boolean]
Deletes this database in the couchdb instance if it exists.
Deletes this database in the couchdb instance if it exists. Returns
true
iff the database was actually deleted. -
def
deleteAttachment(docId: String, attachment: String): Future[Boolean]
Deletes the given attachment for the given docId
-
def
deleteDoc(id: String): Future[Boolean]
Deletes the document identified by the given id from the database.
Deletes the document identified by the given id from the database. If the document exists it is deleted and the method returns
true
, otherwise returnsfalse
. -
def
deleteDoc[T](doc: T)(implicit arg0: CouchFormat[T]): Future[Boolean]
Deletes the document from the database.
Deletes the document from the database. The document will only be deleted if the caller provided the last revision
- Definition Classes
- DocumentOps
-
def
deleteDocRevs(docs: List[(String, String)]): Future[List[DbResult]]
Deletes a bunch of document revisions at once returning the results for each identifier in the document list.
Deletes a bunch of document revisions at once returning the results for each identifier in the document list. One can choose the update strategy by setting the parameter
all_or_nothing
totrue
orfalse
. -
def
deleteDocs(ids: Iterable[String]): Future[List[DbResult]]
Deletes a bunch of documents at once returning the results for each identifier in the document list.
Deletes a bunch of documents at once returning the results for each identifier in the document list. One can choose the update strategy by setting the parameter
all_or_nothing
totrue
orfalse
. -
def
design(designName: String, language: String = "javascript"): Design
Returns a design object that allows user to work with views
-
implicit
val
ec: ExecutionContext
- Definition Classes
- Database → DocumentOps
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exists: Future[Boolean]
Indicates whether this database exists
-
def
explain(query: Query): Future[Explanation]
Explains how the query is run by the CouchDB server.
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
find[T <: AnyRef](query: Query)(implicit arg0: JsonReader[T]): Future[SearchResult[T]]
Finds documents using the declarative mango query syntax.
Finds documents using the declarative mango query syntax. See sohva.mango for details.
-
def
find[T <: AnyRef](selector: Selector, fields: Iterable[String] = Nil, sort: Seq[Sort], limit: Option[Int] = None, skip: Option[Int] = None, use_index: Option[UseIndex] = None)(implicit arg0: JsonReader[T]): Future[SearchResult[T]]
Finds documents using the declarative mango query syntax.
Finds documents using the declarative mango query syntax. See sohva.mango for details.
-
def
getAttachment(docId: String, attachment: String): Future[Option[(String, ByteString)]]
Returns the given attachment for the given docId.
Returns the given attachment for the given docId. It returns the mime type if any given in the response and the input stream to read the response from the server.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
getDocById[T](id: String, revision: Option[String] = None)(implicit arg0: JsonReader[T]): Future[Option[T]]
Returns the document identified by the given id if it exists
Returns the document identified by the given id if it exists
- Definition Classes
- DocumentOps
-
def
getDocRevision(id: String): Future[Option[String]]
Returns the current revision of the document if it exists
-
def
getDocRevisions(ids: Iterable[String]): Future[List[(String, String)]]
Returns the current revision of the documents
-
def
getDocsById[T](ids: Iterable[String])(implicit arg0: JsonReader[T]): Future[List[T]]
Returns all the documents with given identifiers and of the given type.
Returns all the documents with given identifiers and of the given type. If the document with an identifier exists in the database but has not the required type, it is not added to the result
-
def
getRevsLimit: Future[Int]
Gets the current database revision limit.
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
http(req: HttpRequest): Future[JsValue]
- Attributes
- protected[gnieh.sohva]
- Definition Classes
- Database → DocumentOps
-
def
info: Future[Option[InfoResult]]
Returns the information about this database
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
missingRevs(revs: Map[String, Iterable[String]]): Future[Map[String, Vector[String]]]
Returns the revision for each document in the map that are not present in this node.
- val name: String
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
optHttp(req: HttpRequest): Future[Option[JsValue]]
- Attributes
- protected[gnieh.sohva]
- Definition Classes
- Database → DocumentOps
-
def
patchDoc[T](id: String, rev: String, patch: diffson.sprayJson.JsonPatch)(implicit arg0: CouchFormat[T]): Future[T]
Patches the document identified by the given identifier in the given revision.
Patches the document identified by the given identifier in the given revision. This will work if the revision is the last one, or if it is not but the automatic conflict manager manages to solve the potential conflicts. The patched revision is returned. If something went wrong, an exception is raised
-
def
revsDiff(revs: Map[String, Iterable[String]]): Future[Map[String, RevDiff]]
Given a list of documents and revisions, returns the revision that are missing in this node.
-
def
saveDoc[T](doc: T)(implicit arg0: CouchFormat[T]): Future[T]
Creates or updates the given object as a document into this database The given object must have an
_id
and an optional_rev
fields to conform to the couchdb document structure.Creates or updates the given object as a document into this database The given object must have an
_id
and an optional_rev
fields to conform to the couchdb document structure. The saved revision is returned. If something went wrong, an exception is raised- Definition Classes
- DocumentOps
-
def
saveDocs[T](docs: Iterable[T])(implicit arg0: CouchFormat[T]): Future[List[DbResult]]
Creates or updates a bunch of documents into the database.
-
def
saveRawDoc(doc: JsValue): Future[JsValue]
- Attributes
- protected[this]
- Definition Classes
- DocumentOps
-
def
saveSecurityDoc(doc: SecurityDoc): Future[Boolean]
Creates or updates the security document.
Creates or updates the security document. Security documents are special documents with no
_id
nor_rev
fields. -
def
securityDoc: Future[SecurityDoc]
Returns the security document of this database if any defined
-
def
setRevsLimit(l: Int): Future[Boolean]
Sets the current database revision limit.
-
val
strategy: Strategy
- Definition Classes
- Database → DocumentOps
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- Database → AnyRef → Any
-
val
uri: Uri
- Attributes
- protected[gnieh.sohva]
- Definition Classes
- Database → DocumentOps
-
def
viewCleanup: Future[Boolean]
Cleanups old views.
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
object
changes
extends ChangeStream
Exposes the interface to change stream for this database.
-
object
index
extends Index
Exposes the interface for managing indices.
-
object
local
extends Local
Exposes the interface for managing local (non-replicating) documents.
Deprecated Value Members
-
def
_all_docs(key: Option[String] = None, keys: Iterable[String] = Nil, startkey: Option[String] = None, startkey_docid: Option[String] = None, endkey: Option[String] = None, endkey_docid: Option[String] = None, limit: Int = 1, stale: Option[String] = None, descending: Boolean = false, skip: Int = 0, inclusive_end: Boolean = true): Future[List[String]]
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) Use
allDocs
instead
-
def
bulkDocs[T](operations: Iterable[BulkOp[T]], all_or_nothing: Boolean)(implicit arg0: CouchFormat[T]): Future[List[DbResult]]
Performs bulk document update.
Performs bulk document update.
- Annotations
- @deprecated
- Deprecated
(Since version Sohva 2.2.0)
all_or_nothing
was removed in CouchDB 2.0 and will have no effect
-
def
deleteDocRevs(docs: List[(String, String)], all_or_nothing: Boolean = false): Future[List[DbResult]]
Deletes a bunch of document revisions at once returning the results for each identifier in the document list.
Deletes a bunch of document revisions at once returning the results for each identifier in the document list. One can choose the update strategy by setting the parameter
all_or_nothing
totrue
orfalse
.- Annotations
- @deprecated
- Deprecated
(Since version Sohva 2.2.0)
all_or_nothing
was removed in CouchDB 2.0 and will have no effect
-
def
deleteDocs(ids: Iterable[String], all_or_nothing: Boolean): Future[List[DbResult]]
Deletes a bunch of documents at once returning the results for each identifier in the document list.
Deletes a bunch of documents at once returning the results for each identifier in the document list. One can choose the update strategy by setting the parameter
all_or_nothing
totrue
orfalse
.- Annotations
- @deprecated
- Deprecated
(Since version Sohva 2.2.0)
all_or_nothing
was removed in CouchDB 2.0 and will have no effect
-
def
ensureFullCommit: Future[Boolean]
Ensures that all changes are written to disk.
Ensures that all changes are written to disk.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) You shouldn't need to call this if you have the recommended setting
delayed_commits=false
-
def
getRawDocById(id: String, revision: Option[String] = None): Future[Option[JsValue]]
Returns the raw representation of the document identified by the given id if it exists.
Returns the raw representation of the document identified by the given id if it exists.
- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) Use
getDocById
with return typeJsValue
instead
-
def
saveDocs[T](docs: Iterable[T], all_or_nothing: Boolean)(implicit arg0: CouchFormat[T]): Future[List[DbResult]]
Creates or updates a bunch of documents into the database.
Creates or updates a bunch of documents into the database.
- Annotations
- @deprecated
- Deprecated
(Since version Sohva 2.2.0)
all_or_nothing
was removed in CouchDB 2.0 and will have no effect
-
def
temporaryView(viewDoc: ViewDoc): View
Returns a temporary view of this database, specified by the
ViewDoc
.Returns a temporary view of this database, specified by the
ViewDoc
.- Annotations
- @deprecated
- Deprecated
(Since version 2.0.0) Temporary view were removed in CouchDB 2.0 and should not be used
CouchDB1
Operation only available in CouchDB 1
CouchDB2
Operation only available in CouchDB 2
Ungrouped
LowLevel
Low-level classes that may break compatibility even between patch and minor versions