NoSQL database based on Apache CouchDB

See: https://cloud.ibm.com/docs/services/Cloudant/

Hierarchy

  • default
    • export=

Constructors

Properties

Methods

configureService createRequest deleteAttachment deleteDatabase deleteDesignDocument deleteDocument deleteIndex deleteLocalDocument deleteReplicationDocument getActiveTasks getActivityTrackerEvents getAllDbs getAttachment getCapacityThroughputInformation getCorsInformation getCurrentThroughputInformation getDatabaseInformation getDbUpdates getDesignDocument getDesignDocumentInformation getDocument getDocumentAsMixed getDocumentAsRelated getDocumentAsStream getDocumentShardsInfo getGeo getGeoAsStream getGeoIndexInformation getIndexesInformation getLocalDocument getMembershipInformation getPartitionInformation getReplicationDocument getSchedulerDocs getSchedulerDocument getSchedulerJob getSchedulerJobs getSearchInfo getSecurity getServerInformation getSessionInformation getShardsInformation getUpInformation getUuids headAttachment headDatabase headDesignDocument headDocument headLocalDocument headReplicationDocument headSchedulerDocument headSchedulerJob headUpInformation postActivityTrackerEvents postAllDocs postAllDocsAsStream postAllDocsQueries postAllDocsQueriesAsStream postApiKeys postBulkDocs postBulkGet postBulkGetAsMixed postBulkGetAsRelated postBulkGetAsStream postChanges postChangesAsStream postDbsInfo postDesignDocs postDesignDocsQueries postDocument postExplain postFind postFindAsStream postGeoCleanup postIndex postPartitionAllDocs postPartitionAllDocsAsStream postPartitionFind postPartitionFindAsStream postPartitionSearch postPartitionSearchAsStream postPartitionView postPartitionViewAsStream postRevsDiff postSearch postSearchAnalyze postSearchAsStream postView postViewAsStream postViewQueries postViewQueriesAsStream putAttachment putCapacityThroughputConfiguration putCloudantSecurityConfiguration putCorsConfiguration putDatabase putDesignDocument putDocument putLocalDocument putReplicationDocument putSecurity setEnableGzipCompression setServiceUrl newInstance

Constructors

  • new export=(options: UserOptions): export=
  • Construct a CloudantV1 object.

    Returns

    Parameters

    • options: UserOptions

      Options for the service.

    Returns export=

Properties

DEFAULT_SERVICE_NAME: string = 'cloudant'
DEFAULT_SERVICE_URL: string = 'http://localhost:5984'

Methods

  • configureService(serviceName: string): void
  • Configure the service using external configuration Cloudant specific extensions:

    • Apply the new base service options on CouchdbSessionAuthenticator.

    Parameters

    • serviceName: string

      The name of the service. Will be used to read from external configuration.

    Returns void

  • createRequest(parameters: any): Promise<any>
  • Extend createRequest to handle document and attachment validation.

    Parameters

    • parameters: any

    Returns Promise<any>

  • Delete an attachment.

    Deletes the attachment with the filename, {attachment_name}, from the specified doc. You must supply the rev query parameter or If-Match header with the current revision to delete the attachment.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.DocumentResult>>

  • Delete a database.

    Deletes the specified database and all documents and attachments contained within it. To avoid deleting a database, the server responds with a 400 HTTP status code when the request URL includes a ?rev= parameter. This response suggests that a user wanted to delete a document but forgot to add the document ID to the URL.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.Ok>>

  • Delete a design document.

    Marks the specified design document as deleted by adding a _deleted field with the value true. Documents with this field are not returned with requests but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.DocumentResult>>

  • Delete a document.

    Marks the specified document as deleted by adding a _deleted field with the value true. Documents with this field are not returned within requests anymore but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.DocumentResult>>

  • Delete a local document.

    Deletes the specified local document. The semantics are identical to deleting a standard document in the specified database, except that the document is not replicated.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.DocumentResult>>

  • Retrieve list of running tasks.

    Lists running tasks, including the task type, name, status, and process ID. The result includes a JSON array of the currently running tasks, with each task described as a single object. Depending on the operation type, the set of response object fields might be different.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.ActiveTask[]>>

  • Query a list of all database names in the instance.

    Returns

    Parameters

    Returns Promise<export=.Response<string[]>>

  • Retrieve an attachment.

    Returns the file attachment that is associated with the document. The raw data of the associated attachment is returned, just as if you were accessing a static file. The returned Content-Type header is the same as the content type set when the document attachment was submitted to the database.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Retrieve the current provisioned throughput capacity consumption.

    View the current consumption of provisioned throughput capacity for an IBM Cloudant instance. The current consumption shows the quantities of reads, writes, and global queries conducted against the instance for a given second.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.CurrentThroughputInformation>>

  • Retrieve a design document.

    Returns design document with the specified doc_id from the specified database. Unless you request a specific revision, the current revision of the design document is always returned.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.DesignDocument>>

  • Retrieve a document.

    Returns document with the specified doc_id from the specified database. Unless you request a specific revision, the latest revision of the document is always returned.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.Document>>

  • Retrieve a document as mixed.

    Returns document with the specified doc_id from the specified database. Unless you request a specific revision, the latest revision of the document is always returned.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Retrieve a document as related.

    Returns document with the specified doc_id from the specified database. Unless you request a specific revision, the latest revision of the document is always returned.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Retrieve a document as stream.

    Returns document with the specified doc_id from the specified database. Unless you request a specific revision, the latest revision of the document is always returned.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Retrieve shard information for a specific document.

    Retrieves information about a specific shard where a particular document is stored, along with information about the nodes where that shard has a replica.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.DocumentShardInfo>>

  • Query a geospatial index as stream.

    Executes a query against the requested geospatial index from the specified design document.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Retrieve information about all indexes.

    When you make a GET request to /db/_index, you get a list of all indexes used by Cloudant Query in the database, including the primary index. In addition to the information available through this API, indexes are also stored in the indexes property of design documents.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.IndexesInformation>>

  • Retrieve a local document.

    Retrieves the specified local document. The semantics are identical to accessing a standard document in the specified database, except that the document is not replicated.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.Document>>

  • Retrieve cluster membership information.

    Displays the nodes that are part of the cluster as cluster_nodes. The field, all_nodes, displays all nodes this node knows about, including the ones that are part of the cluster. This endpoint is useful when you set up a cluster.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.MembershipInformation>>

  • Retrieve a replication document.

    Retrieves a replication document from the _replicator database to view the configuration of the replication. The status of the replication is no longer recorded in the document but can be checked via the replication scheduler.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.ReplicationDocument>>

  • Retrieve replication scheduler documents.

    Lists replication documents, including information about all documents, even the ones in a completed or failed state. For each document, the endpoint returns the document ID, database, replication ID, source and target, and other information.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.SchedulerDocsResult>>

  • Retrieve a replication scheduler document.

    Retrieves information about a replication document from the replicator database. The endpoint returns the document ID, database, replication ID, source and target, and other information.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.SchedulerDocument>>

  • Retrieve replication scheduler jobs.

    Retrieves information about replications that were created via /_replicate endpoint, as well as those created from replication documents. It doesn't include replications that completed or failed to start because replication documents were malformed. Each job description includes source and target information, replication ID, history of recent events, and other information.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.SchedulerJobsResult>>

  • Retrieve information about whether the server is up.

    Confirms that the server is up, running, and ready to respond to requests. If maintenance_mode is true or nolb, the endpoint returns a 404 response.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.UpInformation>>

  • Retrieve one or more UUIDs.

    Requests one or more Universally Unique Identifiers (UUIDs) from the instance. The response is a JSON object that provides a list of UUIDs.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.UuidsResult>>

  • Retrieve HTTP headers for a replication scheduler document.

    Retrieves the HTTP headers containing minimal amount of information about the specified replication scheduler document. Since the response body is empty, using the HEAD method is a lightweight way to check if the replication scheduler document exists or not.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.Empty>>

  • Retrieve the HTTP headers for a replication scheduler job.

    Returns the HTTP headers that contain a minimal amount of information about the specified replication task. Only the header information is returned.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.Empty>>

  • Query a list of all documents in a database.

    Queries the primary index (all document IDs). The results that match the request body parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all documents in the database are returned. Optionally, document content or additional metadata can be included in the response.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.AllDocsResult>>

  • Query a list of all documents in a database as stream.

    Queries the primary index (all document IDs). The results that match the request body parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all documents in the database are returned. Optionally, document content or additional metadata can be included in the response.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Multi-query the list of all documents in a database.

    Runs multiple queries using the primary index (all document IDs). Returns a JSON object that contains a list of result objects, one for each query, with a structure equivalent to that of a single _all_docs request. This enables you to request multiple queries in a single request, in place of multiple POST /{db}/_all_docs requests.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.AllDocsQueriesResult>>

  • Multi-query the list of all documents in a database as stream.

    Runs multiple queries using the primary index (all document IDs). Returns a JSON object that contains a list of result objects, one for each query, with a structure equivalent to that of a single _all_docs request. This enables you to request multiple queries in a single request, in place of multiple POST /{db}/_all_docs requests.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Generates API keys for apps or persons to enable database access.

    Generates API keys to enable database access for a person or application, but without creating a new IBM Cloudant account for that person or application. An API key is a randomly generated username and password. The key is given the wanted access permissions for a database.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.ApiKeysResult>>

  • Bulk modify multiple documents in a database.

    The bulk document API allows you to create, update, and delete multiple documents at the same time within a single request. The basic operation is similar to creating, updating, or deleting a single document, except that you batch the document structure and information.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.DocumentResult[]>>

  • Bulk query revision information for multiple documents.

    Fetch specific revisions or revision histories for multiple documents in bulk as replicators do.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.BulkGetResult>>

  • Bulk query revision information for multiple documents as mixed.

    Fetch specific revisions or revision histories for multiple documents in bulk as replicators do.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Bulk query revision information for multiple documents as related.

    Fetch specific revisions or revision histories for multiple documents in bulk as replicators do.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Bulk query revision information for multiple documents as stream.

    Fetch specific revisions or revision histories for multiple documents in bulk as replicators do.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Query the database document changes feed.

    Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter.

    Note

    Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.".

    Returns

    Parameters

    Returns Promise<export=.Response<export=.ChangesResult>>

  • Query the database document changes feed as stream.

    Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter.

    Note

    Before using the changes feed we recommend reading the FAQs to understand the limitations and appropriate use cases.".

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Query information about multiple databases.

    This operation enables you to request information about multiple databases in a single request, instead of issuing multiple GET /{db} requests. It returns a list that contains an information object for each database specified in the request.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.DbsInfoResult[]>>

  • Query a list of all design documents in a database.

    Queries the index of all design document IDs. The results matching the request body parameters are returned in a JSON object, including a list of matching design documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all design documents in the database are returned. Optionally, the design document content or additional metadata can be included in the response.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.AllDocsResult>>

  • Multi-query the list of all design documents.

    This operation runs multiple view queries of all design documents in the database. This operation enables you to request numerous queries in a single request, in place of multiple POST /{db}/_design_docs requests.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.AllDocsQueriesResult>>

  • Create or modify a document in a database.

    Creates or modifies a document in the specified database by using the supplied JSON document.

    For creation, you may specify the document ID but you should not specify the revision. If you don't specify the document ID, then the server generates an ID for your document.

    For modification, you must specify the document ID and a revision identifier in the JSON document.

    If your document ID includes the _local/ or _design/ prefix, then this operation creates or modifies a local or a design document respectively.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.DocumentResult>>

  • Query an index by using selector syntax.

    Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

    Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a significant performance impact causing a full scan of the database with each request. In this case the response body will include a warning field recommending that an index is created.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.FindResult>>

  • Query an index by using selector syntax as stream.

    Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

    Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a significant performance impact causing a full scan of the database with each request. In this case the response body will include a warning field recommending that an index is created.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Cleanup old geospatial indexes.

    Cleanup old geospatial indexes from disk that have been superseded by newer index builds.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.Ok>>

  • Query a list of all documents in a database partition.

    Queries the primary index (all document IDs). The results that match the query parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no query parameters are specified, results for all documents in the database partition are returned. Optionally, document content or additional metadata can be included in the response.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.AllDocsResult>>

  • Query a list of all documents in a database partition as stream.

    Queries the primary index (all document IDs). The results that match the query parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no query parameters are specified, results for all documents in the database partition are returned. Optionally, document content or additional metadata can be included in the response.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Query a database partition index by using selector syntax.

    Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

    Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.FindResult>>

  • Query a database partition index by using selector syntax as stream.

    Query documents by using a declarative JSON querying syntax. It's best practice to create an appropriate index for all fields in selector by using the _index endpoint.

    Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Query a database partition search index.

    Partitioned Search indexes, which are defined in design documents, allow partition databases to be queried by using Lucene Query Parser Syntax. Search indexes are defined by an index function, similar to a map function in MapReduce views. The index function decides what data to index and store in the index.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.SearchResult>>

  • Query a database partition search index as stream.

    Partitioned Search indexes, which are defined in design documents, allow partition databases to be queried by using Lucene Query Parser Syntax. Search indexes are defined by an index function, similar to a map function in MapReduce views. The index function decides what data to index and store in the index.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Query a database partition MapReduce view function.

    Runs the specified view function from the specified design document. Unlike GET /{db}/_design/{ddoc}/_view/{view} for accessing views, the POST method supports the specification of explicit keys to be retrieved from the view results. The remainder of the POST view functionality is identical to the GET /{db}/_design/{ddoc}/_view/{view} API.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.ViewResult>>

  • Query a database partition MapReduce view function as stream.

    Runs the specified view function from the specified design document. Unlike GET /{db}/_design/{ddoc}/_view/{view} for accessing views, the POST method supports the specification of explicit keys to be retrieved from the view results. The remainder of the POST view functionality is identical to the GET /{db}/_design/{ddoc}/_view/{view} API.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Query a search index.

    Search indexes, which are defined in design documents, allow databases to be queried by using Lucene Query Parser Syntax. An index function defines a search index, similar to a map function in MapReduce views. The index function decides what data to index and what data to store in the index. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.SearchResult>>

  • Query a search index as stream.

    Search indexes, which are defined in design documents, allow databases to be queried by using Lucene Query Parser Syntax. An index function defines a search index, similar to a map function in MapReduce views. The index function decides what data to index and what data to store in the index. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Query a MapReduce view as stream.

    This operation queries the specified MapReduce view of the specified design document. By default, the map and reduce functions of the view are run to update the view before returning the response. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Multi-query a MapReduce view as stream.

    This operation runs multiple specified view queries against the view function from the specified design document.

    Returns

    Parameters

    Returns Promise<export=.Response<ReadableStream>>

  • Create or modify an attachment.

    Uploads the supplied content as an attachment to the specified document. The attachment name that you provide must be a URL encoded string. You must supply the Content-Type header, and for an existing document, you must also supply either the rev query argument or the If-Match HTTP header. If you omit the revision, a new, otherwise empty, document is created with the provided attachment, or a conflict occurs. If the uploaded attachment uses an existing attachment name in the remote database, it updates the corresponding stored content of the database. Since you must supply the revision information to add an attachment to the document, this serves as validation to update the existing attachment.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.DocumentResult>>

  • Modify only Cloudant related database permissions.

    Modify only Cloudant related permissions to database. Be careful: by removing an API key from the list, you remove the API key from the list of users that have access to the database.

    Note about nobody role

    The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.Ok>>

  • Modify CORS configuration.

    Sets the CORS configuration. The configuration applies to all databases and all account level endpoints in your account.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.Ok>>

  • Create or modify a document.

    Creates or modifies a document in the specified database.

    For creation, you must specify the document ID but you should not specify the revision.

    For modification, you must specify the document ID and a revision identifier.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.DocumentResult>>

  • Create or modify a local document.

    Stores the specified local document. The semantics are identical to storing a standard document in the specified database, except that the document is not replicated.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.DocumentResult>>

  • Modify database permissions.

    Modify who has permission to read, write, or manage a database. This endpoint can be used to modify both Cloudant and CouchDB related permissions. Be careful: by removing a Cloudant API key, a member or an admin from the list of users that have access permissions, you remove it from the list of users that have access to the database.

    Note about nobody role

    The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.

    Returns

    Parameters

    Returns Promise<export=.Response<export=.Ok>>

  • setEnableGzipCompression(setting: boolean): void
  • Turn request body compression on or off. Cloudant specific extensions:

    • Apply the gzip compression option on CouchdbSessionAuthenticator.

    Parameters

    • setting: boolean

      Will turn it on if 'true', off if 'false'.

    Returns void

  • setServiceUrl(url: string): void
  • Set the service URL to send requests to and use the new service URL for CouchDB Session Authentication to claim session token from.

    Parameters

    • url: string

      The base URL for the service.

    Returns void

  • newInstance(options?: UserOptions): export=

  • Factory method


    Parameters

    • Optional options: UserOptions

    Returns export=

Generated using TypeDoc