问题
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