| {% include anchor.html edit="true" title="Delete a database" hash="delete_database"%} |
| |
| {% highlight js %} |
| db.destroy([options], [callback]) |
| {% endhighlight %} |
| |
| Delete the database. Note that this has no impact on other replicated databases. |
| |
| ### Options |
| |
| * `options.ajax`: (Remote databases only.) Ajax requester options, [as described above](#create_database). |
| |
| #### Example Usage |
| |
| {% include code/start.html id="destroy_db" type="callback" %} |
| {% highlight js %} |
| db.destroy(function (err, response) { |
| if (err) { |
| return console.log(err); |
| } else { |
| // success |
| } |
| }); |
| {% endhighlight %} |
| {% include code/end.html %} |
| |
| {% include code/start.html id="destroy_db" type="async" %} |
| |
| {% highlight js %} |
| try { |
| await db.destroy(); |
| } catch (err) { |
| console.log(err); |
| } |
| {% endhighlight %} |
| {% include code/end.html %} |
| |
| {% include code/start.html id="destroy_db" type="promise" %} |
| |
| {% highlight js %} |
| db.destroy().then(function (response) { |
| // success |
| }).catch(function (err) { |
| console.log(err); |
| }); |
| {% endhighlight %} |
| {% include code/end.html %} |
| |
| #### Example Response: |
| {% highlight js %} |
| { |
| "ok" : true |
| } |
| {% endhighlight %} |