简体   繁体   English

CouchDB保存文档uri错误

[英]CouchDB save doc uri incorrect

I am really scratching my head over this one. 我真的很head头。 I am using cloudant as my couchdb provider and attempting to save a document to my db. 我将cloudant用作我的ouchdb提供程序,并尝试将文档保存到我的数据库中。 I first establish what my db is in the following code. 我首先在下面的代码中建立我的数据库。

db = jQuery.couch.db(" https://fullscore.cloudant.com/fullscore "); 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. 我做了一个console.log,发现该对象中的URI和名称正确。

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/ 但是,当我查看该帖子时,它发布到: 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? 显然,有一些内置内容可以附加到cloudant.com上……任何人都知道如何可以覆盖它? Or perhaps its some other problem? 还是其他问题? I'm getting a 404 error. 我收到404错误。

--Ashley -阿什利

To clarify the exact code, you need to set the URL prefix on your couch object, then use just the db name: 为了阐明确切的代码,您需要在沙发对象上设置URL前缀,然后仅使用数据库名称:

$.couch.urlPrefix = "https://username.cloudant.com";
var db = $.couch.db("dbname");

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM