Packages

c

gnieh.sohva

Database

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

Linear Supertypes
DocumentOps, AnyRef, Any
Known Subclasses
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. Database
  2. DocumentOps
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. 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

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. 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.

  7. 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.

  8. 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.

  9. def bulkDocs[T](operations: Iterable[BulkOp[T]])(implicit arg0: CouchFormat[T]): Future[List[DbResult]]

    Performs bulk document update.

  10. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def compact: Future[Boolean]

    Requests a database compaction.

  12. 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

  13. val couch: CouchDB
  14. 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.

  15. 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.

  16. 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.

  17. val credit: Int
    Definition Classes
    DatabaseDocumentOps
  18. 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.

  19. def deleteAttachment(docId: String, attachment: String): Future[Boolean]

    Deletes the given attachment for the given docId

  20. 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 returns false.

  21. 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
  22. 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 to true or false.

  23. 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 to true or false.

  24. def design(designName: String, language: String = "javascript"): Design

    Returns a design object that allows user to work with views

  25. implicit val ec: ExecutionContext
    Definition Classes
    DatabaseDocumentOps
  26. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  27. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  28. def exists: Future[Boolean]

    Indicates whether this database exists

  29. def explain(query: Query): Future[Explanation]

    Explains how the query is run by the CouchDB server.

  30. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  31. 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.

  32. 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.

  33. 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.

  34. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  35. 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
  36. def getDocRevision(id: String): Future[Option[String]]

    Returns the current revision of the document if it exists

  37. def getDocRevisions(ids: Iterable[String]): Future[List[(String, String)]]

    Returns the current revision of the documents

  38. 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

  39. def getRevsLimit: Future[Int]

    Gets the current database revision limit.

  40. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  41. def http(req: HttpRequest): Future[JsValue]
    Attributes
    protected[gnieh.sohva]
    Definition Classes
    DatabaseDocumentOps
  42. def info: Future[Option[InfoResult]]

    Returns the information about this database

  43. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  44. 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.

  45. val name: String
  46. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  47. final def notify(): Unit
    Definition Classes
    AnyRef
  48. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  49. def optHttp(req: HttpRequest): Future[Option[JsValue]]
    Attributes
    protected[gnieh.sohva]
    Definition Classes
    DatabaseDocumentOps
  50. 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

  51. 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.

  52. 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
  53. def saveDocs[T](docs: Iterable[T])(implicit arg0: CouchFormat[T]): Future[List[DbResult]]

    Creates or updates a bunch of documents into the database.

  54. def saveRawDoc(doc: JsValue): Future[JsValue]
    Attributes
    protected[this]
    Definition Classes
    DocumentOps
  55. 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.

  56. def securityDoc: Future[SecurityDoc]

    Returns the security document of this database if any defined

  57. def setRevsLimit(l: Int): Future[Boolean]

    Sets the current database revision limit.

  58. val strategy: Strategy
    Definition Classes
    DatabaseDocumentOps
  59. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  60. def toString(): String
    Definition Classes
    Database → AnyRef → Any
  61. val uri: Uri
    Attributes
    protected[gnieh.sohva]
    Definition Classes
    DatabaseDocumentOps
  62. def viewCleanup: Future[Boolean]

    Cleanups old views.

  63. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  64. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  65. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  66. object changes extends ChangeStream

    Exposes the interface to change stream for this database.

  67. object index extends Index

    Exposes the interface for managing indices.

  68. object local extends Local

    Exposes the interface for managing local (non-replicating) documents.

Deprecated Value Members

  1. 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

  2. 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

  3. 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 to true or false.

    Annotations
    @deprecated
    Deprecated

    (Since version Sohva 2.2.0) all_or_nothing was removed in CouchDB 2.0 and will have no effect

  4. 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 to true or false.

    Annotations
    @deprecated
    Deprecated

    (Since version Sohva 2.2.0) all_or_nothing was removed in CouchDB 2.0 and will have no effect

  5. 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

  6. 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 type JsValue instead

  7. 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

  8. 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

Inherited from DocumentOps

Inherited from AnyRef

Inherited from Any

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