CornerCouch icon indicating copy to clipboard operation
CornerCouch copied to clipboard

Get database automatically

Open avanc opened this issue 11 years ago • 3 comments

Hello,

thank you very much. CornerCouch makes it very easy to access CouchDB from AngularJS. However, I have a question regarding $scope.server.getDB('dbname'): I'm using it within a CouchApp. I would guess that I can skip mentioning the dbname explicitly, as I want to use the same database which servers the CouchApp. Do I have to parse the URL by hand to avoid mentioning the dbname explicitly in the App?

Any hints would be appreciated.

Sven

avanc avatar Sep 01 '13 13:09 avanc

This is the approach I'd take. I'd be happy to accept a pull request when you work out the detail:

CouchServer.prototype.getDB = function(dbName) {
    if (!dbName) {
        // do some parsing on location and set dbName
    }
    return new CouchDB(dbName, this.uri, this.method);
};

Cheers,

Jochen

eddelplus avatar Sep 05 '13 09:09 eddelplus

Where I have to add this definition? I always get error that CouchServer is not defined.

avanc avatar Sep 06 '13 21:09 avanc

It is part of the CornerCouch code.

eddelplus avatar Sep 09 '13 07:09 eddelplus