ouchdb:设计文档中的地图给出了compile_error [英] couchdb: map in design document gives compilation_error

查看:49
本文介绍了ouchdb:设计文档中的地图给出了compile_error的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Debian测试中使用了Couchdb 1.1.1

I use Couchdb 1.1.1 in Debian testing

并且我在数据库中有此设计文档

and I have this design document in database

{
 "_id": "_design/Page",
 "_rev": "9-1944cdebabf20ae569eab7b534b43e67",
 "views": {
     "all": {
         "map": "function(doc) {}"
     }
 },
 "language": "javascript"
}

但我仍然进入 http:// localhost:5984 / db_development / _design / Page / _view / all

{错误: compilation_error,原因:表达式不等于一个函数。((new String(\ function(doc){} \)))}

我试图在Spidermonkey-bin解释器中运行不同的简单地图函数,并且它们已正确加载,但是在沙发数据库中出现了相同的错误

I tried to run different simple map functions in spidermonkey-bin interpreter and they was loaded correctly, but same error in couchdb

我真的看不到,问题出在哪里....

I really can't see, where problem is....

好吧,在邮件列表中,我发现需要将函数包装在括号()上,因为新的Spidermonkey有所更改

Ok, in mailing list I found that it is needed to wrap function to parentheses "()", because something has changed in newer spidermonkey

所以地图函数看起来像这样: map:(function(doc){

So map function looks like this: "map": "(function(doc) { emit([doc._id, doc._rev]);})"

推荐答案

好,在邮件列表中,我发现需要将函数包装到括号中 (),因为新的Spidermonkey中发生了一些变化

Ok, in mailing list I found that it is needed to wrap function to parentheses "()", because something has changed in newer spidermonkey

因此,地图函数如下所示: map:(function(doc){酋长([doc._id ,doc._rev]);})

So map function looks like this: "map": "(function(doc) { emit([doc._id, doc._rev]);})"

这篇关于ouchdb:设计文档中的地图给出了compile_error的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆