|
| 1 | +## API Reference |
| 2 | +## Classes |
| 3 | + |
| 4 | +<dl> |
| 5 | +<dt><a href="#Collection">Collection</a></dt> |
| 6 | +<dd><p>Collection operations supported by the driver.</p></dd> |
| 7 | +</dl> |
| 8 | + |
| 9 | +## Functions |
| 10 | + |
| 11 | +<dl> |
| 12 | +<dt><a href="#createAstraUri">createAstraUri(databaseId, region, keyspace, applicationToken, baseApiPath, logLevel, authHeaderName)</a> ⇒</dt> |
| 13 | +<dd><p>Create an Astra connection URI while connecting to Astra JSON API</p></dd> |
| 14 | +<dt><a href="#createStargateUri">createStargateUri(baseUrl, baseAuthUrl, keyspace, username, password, logLevel)</a> ⇒</dt> |
| 15 | +<dd><p>Create a JSON API connection URI while connecting to Open source JSON API</p></dd> |
| 16 | +<dt><a href="#getStargateAccessToken">getStargateAccessToken(authUrl, username, password)</a> ⇒</dt> |
| 17 | +<dd><p>Get an access token from Stargate (this is useful while connecting to open source JSON API)</p></dd> |
| 18 | +</dl> |
| 19 | + |
| 20 | +<a name="Collection"></a> |
| 21 | + |
| 22 | +## Collection |
| 23 | +<p>Collection operations supported by the driver.</p> |
| 24 | + |
| 25 | +**Kind**: global class |
| 26 | + |
| 27 | +* [Collection](#Collection) |
| 28 | + * ~~[.count()](#Collection+count)~~ |
| 29 | + * ~~[.count(filter)](#Collection+count)~~ |
| 30 | + * [.countDocuments(filter)](#Collection+countDocuments) |
| 31 | + * [.find(filter, options, callback)](#Collection+find) |
| 32 | + * [.findOne(filter, options)](#Collection+findOne) |
| 33 | + * [.insertOne(doc)](#Collection+insertOne) |
| 34 | + * [.insertMany(documents, options)](#Collection+insertMany) |
| 35 | + * [.findOneAndUpdate(filter, update, options)](#Collection+findOneAndUpdate) |
| 36 | + * [.findOneAndDelete(filter, options)](#Collection+findOneAndDelete) |
| 37 | + * [.findOneAndReplace(filter, newDoc, options)](#Collection+findOneAndReplace) |
| 38 | + * [.deleteMany(filter)](#Collection+deleteMany) |
| 39 | + * [.deleteOne(filter, options, callback)](#Collection+deleteOne) |
| 40 | + * [.updateOne(filter, update, options)](#Collection+updateOne) |
| 41 | + * [.updateMany(filter, update, options)](#Collection+updateMany) |
| 42 | + * [.bulkWrite(ops, options)](#Collection+bulkWrite) |
| 43 | + * [.aggregate(pipeline, options)](#Collection+aggregate) |
| 44 | + * [.bulkSave(docs, options)](#Collection+bulkSave) |
| 45 | + * [.cleanIndexes(options)](#Collection+cleanIndexes) |
| 46 | + * [.listIndexes(options)](#Collection+listIndexes) |
| 47 | + * [.createIndex(fieldOrSpec, options)](#Collection+createIndex) |
| 48 | + * [.dropIndexes()](#Collection+dropIndexes) |
| 49 | + * [.watch()](#Collection+watch) |
| 50 | + * [.distinct()](#Collection+distinct) |
| 51 | + * [.estimatedDocumentCount()](#Collection+estimatedDocumentCount) |
| 52 | + * [.replaceOne()](#Collection+replaceOne) |
| 53 | + * [.syncIndexes()](#Collection+syncIndexes) |
| 54 | + |
| 55 | +<a name="Collection+count"></a> |
| 56 | + |
| 57 | +### ~~collection.count()~~ |
| 58 | +***Deprecated*** |
| 59 | + |
| 60 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 61 | +<a name="Collection+count"></a> |
| 62 | + |
| 63 | +### ~~collection.count(filter)~~ |
| 64 | +***Deprecated*** |
| 65 | + |
| 66 | +<p>Count documents in the collection that match the given filter. Use countDocuments() instead.</p> |
| 67 | + |
| 68 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 69 | + |
| 70 | +| Param | |
| 71 | +| --- | |
| 72 | +| filter | |
| 73 | + |
| 74 | +<a name="Collection+countDocuments"></a> |
| 75 | + |
| 76 | +### collection.countDocuments(filter) |
| 77 | +<p>Count documents in the collection that match the given filter.</p> |
| 78 | + |
| 79 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 80 | + |
| 81 | +| Param | |
| 82 | +| --- | |
| 83 | +| filter | |
| 84 | + |
| 85 | +<a name="Collection+find"></a> |
| 86 | + |
| 87 | +### collection.find(filter, options, callback) |
| 88 | +<p>Find documents in the collection that match the given filter.</p> |
| 89 | + |
| 90 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 91 | + |
| 92 | +| Param | |
| 93 | +| --- | |
| 94 | +| filter | |
| 95 | +| options | |
| 96 | +| callback | |
| 97 | + |
| 98 | +<a name="Collection+findOne"></a> |
| 99 | + |
| 100 | +### collection.findOne(filter, options) |
| 101 | +<p>Find a single document in the collection that matches the given filter.</p> |
| 102 | + |
| 103 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 104 | + |
| 105 | +| Param | |
| 106 | +| --- | |
| 107 | +| filter | |
| 108 | +| options | |
| 109 | + |
| 110 | +<a name="Collection+insertOne"></a> |
| 111 | + |
| 112 | +### collection.insertOne(doc) |
| 113 | +<p>Insert a single document into the collection.</p> |
| 114 | + |
| 115 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 116 | + |
| 117 | +| Param | |
| 118 | +| --- | |
| 119 | +| doc | |
| 120 | + |
| 121 | +<a name="Collection+insertMany"></a> |
| 122 | + |
| 123 | +### collection.insertMany(documents, options) |
| 124 | +<p>Insert multiple documents into the collection.</p> |
| 125 | + |
| 126 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 127 | + |
| 128 | +| Param | |
| 129 | +| --- | |
| 130 | +| documents | |
| 131 | +| options | |
| 132 | + |
| 133 | +<a name="Collection+findOneAndUpdate"></a> |
| 134 | + |
| 135 | +### collection.findOneAndUpdate(filter, update, options) |
| 136 | +<p>Update a single document in a collection.</p> |
| 137 | + |
| 138 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 139 | + |
| 140 | +| Param | |
| 141 | +| --- | |
| 142 | +| filter | |
| 143 | +| update | |
| 144 | +| options | |
| 145 | + |
| 146 | +<a name="Collection+findOneAndDelete"></a> |
| 147 | + |
| 148 | +### collection.findOneAndDelete(filter, options) |
| 149 | +<p>Find a single document in the collection and delete it.</p> |
| 150 | + |
| 151 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 152 | + |
| 153 | +| Param | |
| 154 | +| --- | |
| 155 | +| filter | |
| 156 | +| options | |
| 157 | + |
| 158 | +<a name="Collection+findOneAndReplace"></a> |
| 159 | + |
| 160 | +### collection.findOneAndReplace(filter, newDoc, options) |
| 161 | +<p>Find a single document in the collection and replace it.</p> |
| 162 | + |
| 163 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 164 | + |
| 165 | +| Param | |
| 166 | +| --- | |
| 167 | +| filter | |
| 168 | +| newDoc | |
| 169 | +| options | |
| 170 | + |
| 171 | +<a name="Collection+deleteMany"></a> |
| 172 | + |
| 173 | +### collection.deleteMany(filter) |
| 174 | +<p>Delete one or more documents in a collection that match the given filter.</p> |
| 175 | + |
| 176 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 177 | + |
| 178 | +| Param | |
| 179 | +| --- | |
| 180 | +| filter | |
| 181 | + |
| 182 | +<a name="Collection+deleteOne"></a> |
| 183 | + |
| 184 | +### collection.deleteOne(filter, options, callback) |
| 185 | +<p>Delete a single document in a collection that matches the given filter.</p> |
| 186 | + |
| 187 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 188 | + |
| 189 | +| Param | |
| 190 | +| --- | |
| 191 | +| filter | |
| 192 | +| options | |
| 193 | +| callback | |
| 194 | + |
| 195 | +<a name="Collection+updateOne"></a> |
| 196 | + |
| 197 | +### collection.updateOne(filter, update, options) |
| 198 | +<p>Update a single document in a collection that matches the given filter.</p> |
| 199 | + |
| 200 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 201 | + |
| 202 | +| Param | |
| 203 | +| --- | |
| 204 | +| filter | |
| 205 | +| update | |
| 206 | +| options | |
| 207 | + |
| 208 | +<a name="Collection+updateMany"></a> |
| 209 | + |
| 210 | +### collection.updateMany(filter, update, options) |
| 211 | +<p>Update multiple documents in a collection that match the given filter.</p> |
| 212 | + |
| 213 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 214 | + |
| 215 | +| Param | |
| 216 | +| --- | |
| 217 | +| filter | |
| 218 | +| update | |
| 219 | +| options | |
| 220 | + |
| 221 | +<a name="Collection+bulkWrite"></a> |
| 222 | + |
| 223 | +### collection.bulkWrite(ops, options) |
| 224 | +<p>Bulk write not supported.</p> |
| 225 | + |
| 226 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 227 | + |
| 228 | +| Param | |
| 229 | +| --- | |
| 230 | +| ops | |
| 231 | +| options | |
| 232 | + |
| 233 | +<a name="Collection+aggregate"></a> |
| 234 | + |
| 235 | +### collection.aggregate(pipeline, options) |
| 236 | +<p>Aggregate not supported.</p> |
| 237 | + |
| 238 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 239 | + |
| 240 | +| Param | |
| 241 | +| --- | |
| 242 | +| pipeline | |
| 243 | +| options | |
| 244 | + |
| 245 | +<a name="Collection+bulkSave"></a> |
| 246 | + |
| 247 | +### collection.bulkSave(docs, options) |
| 248 | +<p>Bulk Save not supported.</p> |
| 249 | + |
| 250 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 251 | + |
| 252 | +| Param | |
| 253 | +| --- | |
| 254 | +| docs | |
| 255 | +| options | |
| 256 | + |
| 257 | +<a name="Collection+cleanIndexes"></a> |
| 258 | + |
| 259 | +### collection.cleanIndexes(options) |
| 260 | +<p>Clean indexes not supported.</p> |
| 261 | + |
| 262 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 263 | + |
| 264 | +| Param | |
| 265 | +| --- | |
| 266 | +| options | |
| 267 | + |
| 268 | +<a name="Collection+listIndexes"></a> |
| 269 | + |
| 270 | +### collection.listIndexes(options) |
| 271 | +<p>List indexes not supported.</p> |
| 272 | + |
| 273 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 274 | + |
| 275 | +| Param | |
| 276 | +| --- | |
| 277 | +| options | |
| 278 | + |
| 279 | +<a name="Collection+createIndex"></a> |
| 280 | + |
| 281 | +### collection.createIndex(fieldOrSpec, options) |
| 282 | +<p>Create index not supported.</p> |
| 283 | + |
| 284 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 285 | + |
| 286 | +| Param | |
| 287 | +| --- | |
| 288 | +| fieldOrSpec | |
| 289 | +| options | |
| 290 | + |
| 291 | +<a name="Collection+dropIndexes"></a> |
| 292 | + |
| 293 | +### collection.dropIndexes() |
| 294 | +<p>Drop indexes not supported.</p> |
| 295 | + |
| 296 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 297 | +<a name="Collection+watch"></a> |
| 298 | + |
| 299 | +### collection.watch() |
| 300 | +<p>Watch operation not supported.</p> |
| 301 | + |
| 302 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 303 | +<a name="Collection+distinct"></a> |
| 304 | + |
| 305 | +### collection.distinct() |
| 306 | +<p>Distinct operation not supported.</p> |
| 307 | + |
| 308 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 309 | +<a name="Collection+estimatedDocumentCount"></a> |
| 310 | + |
| 311 | +### collection.estimatedDocumentCount() |
| 312 | +<p>Estimated document count operation not supported.</p> |
| 313 | + |
| 314 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 315 | +<a name="Collection+replaceOne"></a> |
| 316 | + |
| 317 | +### collection.replaceOne() |
| 318 | +<p>Replace one operation not supported.</p> |
| 319 | + |
| 320 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 321 | +<a name="Collection+syncIndexes"></a> |
| 322 | + |
| 323 | +### collection.syncIndexes() |
| 324 | +<p>Sync indexes operation not supported.</p> |
| 325 | + |
| 326 | +**Kind**: instance method of [<code>Collection</code>](#Collection) |
| 327 | +<a name="createAstraUri"></a> |
| 328 | + |
| 329 | +## createAstraUri(databaseId, region, keyspace, applicationToken, baseApiPath, logLevel, authHeaderName) ⇒ |
| 330 | +<p>Create an Astra connection URI while connecting to Astra JSON API</p> |
| 331 | + |
| 332 | +**Kind**: global function |
| 333 | +**Returns**: <p>URL as string</p> |
| 334 | + |
| 335 | +| Param | Description | |
| 336 | +| --- | --- | |
| 337 | +| databaseId | <p>the database id of the Astra database</p> | |
| 338 | +| region | <p>the region of the Astra database</p> | |
| 339 | +| keyspace | <p>the keyspace to connect to</p> | |
| 340 | +| applicationToken | <p>an Astra application token</p> | |
| 341 | +| baseApiPath | <p>baseAPI path defaults to /api/json/v1</p> | |
| 342 | +| logLevel | <p>an winston log level (error: 0, warn: 1, info: 2, http: 3, verbose: 4, debug: 5, silly: 6)</p> | |
| 343 | +| authHeaderName | | |
| 344 | + |
| 345 | +<a name="createStargateUri"></a> |
| 346 | + |
| 347 | +## createStargateUri(baseUrl, baseAuthUrl, keyspace, username, password, logLevel) ⇒ |
| 348 | +<p>Create a JSON API connection URI while connecting to Open source JSON API</p> |
| 349 | + |
| 350 | +**Kind**: global function |
| 351 | +**Returns**: <p>URL as string</p> |
| 352 | + |
| 353 | +| Param | Description | |
| 354 | +| --- | --- | |
| 355 | +| baseUrl | <p>the base URL of the JSON API</p> | |
| 356 | +| baseAuthUrl | <p>the base URL of the JSON API auth (this is generally the Stargate Coordinator auth URL)</p> | |
| 357 | +| keyspace | <p>the keyspace to connect to</p> | |
| 358 | +| username | <p>the username to connect with</p> | |
| 359 | +| password | <p>the password to connect with</p> | |
| 360 | +| logLevel | <p>an winston log level (error: 0, warn: 1, info: 2, http: 3, verbose: 4, debug: 5, silly: 6)</p> | |
| 361 | + |
| 362 | +<a name="getStargateAccessToken"></a> |
| 363 | + |
| 364 | +## getStargateAccessToken(authUrl, username, password) ⇒ |
| 365 | +<p>Get an access token from Stargate (this is useful while connecting to open source JSON API)</p> |
| 366 | + |
| 367 | +**Kind**: global function |
| 368 | +**Returns**: <p>access token as string</p> |
| 369 | + |
| 370 | +| Param | Description | |
| 371 | +| --- | --- | |
| 372 | +| authUrl | <p>the base URL of the JSON API auth (this is generally the Stargate Coordinator auth URL)</p> | |
| 373 | +| username | <p>Username</p> | |
| 374 | +| password | <p>Password</p> | |
| 375 | + |
0 commit comments