我是新来的Couchdb只是几个星期回来我git克隆couchdb应用程序称为沙发 [什么和应用程序]。过了一周,它变得很好,但今天突然间我偶然发现了一些东西。Couchdb和沙发帮助
这里就是我的意思 当我浏览了沙发的应用程序,并尝试没有冠军 它提示和警告框创建邮报“的文件无法被保存:数据库无法创建,则文件已存在。”这是奇怪的看着源我发现需要(在validate_doc_update.js返回其自定义的JSON错误)像这种格式{“禁止”:消息})与禁止的关键
v.forbidden = function(message) {
throw({forbidden : message})
};
v.require = function() {
for (var i=0; i < arguments.length; i++) {
var field = arguments[i];
message = "The '"+field+"' field is required.";
if (typeof newDoc[field] == "undefined") v.forbidden(message);
};
};
在validate_doc_update.js
if (newDoc.type == 'post') {
if (!v.isAuthor()) {
v.unauthorized("Only authors may edit posts.");
}
v.require("created_at", "author", "body", "format", "title");
检查的JSON返回的被发现是从不同的JSON响应状态有它本来的回报通过上述需要功能validate_doc_update.js 这里是JSON {“错误”:“file_exists”,“原因”:“数据库无法创建文件已经存在”}
本作被认为在validation_doc_update验证。 JS只的文件更新
为了证明这一点,我尽量不标题更新文档期间执行,期待它会返回错误,但令人惊讶的文档刚刚保存
所以这里我的问题所有点我提到上述
不validate_doc_update.js唯一的文件更新用在“验证”工作
if YES
then
how can I manage to succeed in updating a post without the error [Weird bypassing the Validation Completely] . + How can execute validation on create of a document
if NO
then
What is the Error {"error":"file_exists","reason":"The database could not be created, the file already exists."} that is prevent a document to be saved
谁能请在这里列出
接受@Robert的点,但有些东西还不清楚 [1.]上面的错误{“error”:“file_exists”,“reason” :“数据库无法创建,文件已经存在”}是在我创建“沙发”应用程序中的新“发布”记录时创建的,而不是在创建新数据库时创建的,因为我知道上述情况如果有人试图创建一个已经存在的数据库,但在创建记录时出现错误是很奇怪的,那么会出现错误,所以请你分享一下我更明白它 – Viren
[2.]如果validate_doc_update。js也在创建期间验证记录,那么如何在沙发应用中应用验证以确保没有标题的情况下不创建帖子,如果在创建帖子时未提供标题,则创建不会发生错误。帖子。 – Viren