Skip to content

Latest commit

 

History

History
374 lines (263 loc) · 10.2 KB

APIReference.md

File metadata and controls

374 lines (263 loc) · 10.2 KB

API Reference

Classes

Collection

Collection operations supported by the driver.

Functions

createAstraUri(apiEndpoint, applicationToken, namespace, baseApiPath, logLevel, authHeaderName)

Create an Astra connection URI while connecting to Astra Data API

createStargateUri(baseUrl, baseAuthUrl, keyspace, username, password, logLevel)

Create a Data API connection URI while connecting to Open source Data API

getStargateAccessToken(authUrl, username, password)

Get an access token from Stargate (this is useful while connecting to open source Data API)

Collection

Collection operations supported by the driver.

Kind: global class

collection.count()

Deprecated

Kind: instance method of Collection

collection.count(filter)

Deprecated

Count documents in the collection that match the given filter. Use countDocuments() instead.

Kind: instance method of Collection

Param
filter

collection.countDocuments(filter)

Count documents in the collection that match the given filter.

Kind: instance method of Collection

Param
filter

collection.find(filter, options, callback)

Find documents in the collection that match the given filter.

Kind: instance method of Collection

Param
filter
options
callback

collection.findOne(filter, options)

Find a single document in the collection that matches the given filter.

Kind: instance method of Collection

Param
filter
options

collection.insertOne(doc)

Insert a single document into the collection.

Kind: instance method of Collection

Param
doc

collection.insertMany(documents, options)

Insert multiple documents into the collection.

Kind: instance method of Collection

Param
documents
options

collection.findOneAndUpdate(filter, update, options)

Update a single document in a collection.

Kind: instance method of Collection

Param
filter
update
options

collection.findOneAndDelete(filter, options)

Find a single document in the collection and delete it.

Kind: instance method of Collection

Param
filter
options

collection.findOneAndReplace(filter, newDoc, options)

Find a single document in the collection and replace it.

Kind: instance method of Collection

Param
filter
newDoc
options

collection.deleteMany(filter)

Delete one or more documents in a collection that match the given filter.

Kind: instance method of Collection

Param
filter

collection.deleteOne(filter, options, callback)

Delete a single document in a collection that matches the given filter.

Kind: instance method of Collection

Param
filter
options
callback

collection.updateOne(filter, update, options)

Update a single document in a collection that matches the given filter.

Kind: instance method of Collection

Param
filter
update
options

collection.updateMany(filter, update, options)

Update multiple documents in a collection that match the given filter.

Kind: instance method of Collection

Param
filter
update
options

collection.bulkWrite(ops, options)

Bulk write not supported.

Kind: instance method of Collection

Param
ops
options

collection.aggregate(pipeline, options)

Aggregate not supported.

Kind: instance method of Collection

Param
pipeline
options

collection.bulkSave(docs, options)

Bulk Save not supported.

Kind: instance method of Collection

Param
docs
options

collection.cleanIndexes(options)

Clean indexes not supported.

Kind: instance method of Collection

Param
options

collection.listIndexes(options)

List indexes not supported.

Kind: instance method of Collection

Param
options

collection.createIndex(fieldOrSpec, options)

Create index not supported.

Kind: instance method of Collection

Param
fieldOrSpec
options

collection.dropIndexes()

Drop indexes not supported.

Kind: instance method of Collection

collection.watch()

Watch operation not supported.

Kind: instance method of Collection

collection.distinct()

Distinct operation not supported.

Kind: instance method of Collection

collection.estimatedDocumentCount()

Estimated document count operation not supported.

Kind: instance method of Collection

collection.replaceOne()

Replace one operation not supported.

Kind: instance method of Collection

collection.syncIndexes()

Sync indexes operation not supported.

Kind: instance method of Collection

createAstraUri(apiEndpoint, applicationToken, namespace, baseApiPath, logLevel, authHeaderName) ⇒

Create an Astra connection URI while connecting to Astra Data API

Kind: global function
Returns:

URL as string

Param Description
databaseId

the database id of the Astra database

region

the region of the Astra database

keyspace

the keyspace to connect to

applicationToken

an Astra application token

baseApiPath

baseAPI path defaults to /api/json/v1

logLevel

an winston log level (error: 0, warn: 1, info: 2, http: 3, verbose: 4, debug: 5, silly: 6)

authHeaderName

createStargateUri(baseUrl, baseAuthUrl, keyspace, username, password, logLevel) ⇒

Create a Data API connection URI while connecting to Open source Data API

Kind: global function
Returns:

URL as string

Param Description
baseUrl

the base URL of the Data API

baseAuthUrl

the base URL of the Data API auth (this is generally the Stargate Coordinator auth URL)

keyspace

the keyspace to connect to

username

the username to connect with

password

the password to connect with

logLevel

an winston log level (error: 0, warn: 1, info: 2, http: 3, verbose: 4, debug: 5, silly: 6)

getStargateAccessToken(username, password) ⇒

Get an access token from Stargate (this is useful while connecting to open source Data API)

Kind: global function
Returns:

access token as string

Param Description
username

Username

password

Password