Browse files

Make it possible to NOT create a new database

  • Loading branch information...
1 parent 3f1c0aa commit 43e5a0d7a2d00346b3a166db1ee345fec088f007 Ross Boucher committed Jan 1, 2010
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/couchdb.js
View
6 lib/couchdb.js
@@ -181,15 +181,17 @@ var CouchServer = {
* @return Database
* @type Object
*/
- database: function(name) {
+ database: function(name, dontCreate) {
var db;
var getUri = (function() { return this.uri; }).bind(this);
var getHttpClient = (function() { return this.httpClient; }).bind(this);
var getUuid = (function() { return this.uuid(); }).bind(this);
name = encodeURIComponent(name);
- if (!this.hasDb(name)){
+ if (!this.hasDb(name) && !dontCreate){
this.createDb(name);
+ } else {
+ return null;
}
if (!/\/$/.test(name)){

0 comments on commit 43e5a0d

Please sign in to comment.