How to define a _find query in couchdb mango with field names that start with dollar sign ($)

青春壹個敷衍的年華 提交于 2019-12-01 22:01:02

问题


Many years ago we launched a project to manage semi-structured information for research projects. We used CouchDB, and at that time it was convenient for us to call the mandatory fields of entries starting with a dollar sign ($) {"id": 123, "$type": "entry", "$owners": ["somebody"],... } I have to clarify that Mango did not exist for CouchDB at that time. Now I would like to run the query to find all the entries of my database which "$type" is "entry". But Mango throws an error because "$type" is not an operator.

{"$type": "entry"}

Does somebody know a way to circumvent this problem that does not require to fix the names on my database?

Is there a way to escape the dollar sign in the names?


回答1:


As mentioned in comments, this is currently not possible, due to an apparent bug in CouchDB:

If you call the _find function with the statement {"$type" : "entry"} Mango throws an error because "$type" is not an operator.



来源:https://stackoverflow.com/questions/55976271/how-to-define-a-find-query-in-couchdb-mango-with-field-names-that-start-with-do

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!