1

I am really scratching my head over this one. I am using cloudant as my couchdb provider and attempting to save a document to my db. I first establish what my db is in the following code.

db = jQuery.couch.db("https://fullscore.cloudant.com/fullscore");

I do a console.log and see that the URI and name are correct in the object.

db.saveDoc(doc, {
                success: function(data) {
                    console.log("posted");
                },
                error: function(status) {
                    console.log("failure");
                }
            });

However when I look at the post, it posts to: https://cloudant.com/https%3A%2F%2Ffullscore.cloudant.com%2Ffullscore/

Which as you can see is totally wrong. Obviously there is something built in to append onto cloudant.com ... anyone know how this can be overridden? Or perhaps its some other problem? I'm getting a 404 error.

--Ashley

4

2 回答 2

1

为了阐明确切的代码,您需要在沙发对象上设置 URL 前缀,然后只使用数据库名称:

$.couch.urlPrefix = "https://username.cloudant.com";
var db = $.couch.db("dbname");
于 2013-05-09T16:25:16.790 回答
0

我猜你是在一个你只应该传递数据库名称的地方传递完整的数据库 URL(即https://fullscore.cloudant.com/fullscore中的后一个“fullscore”部分)。你'可能已经在您的程序中的某个较早的时间点设置了主机名。

于 2013-03-13T09:52:45.837 回答