How to access fields of a CouchDB document

筅森魡賤 提交于 2019-12-12 01:22:23

问题


I have defined a permits field for a couchdb document like below. I cannot access permits content by *.permits.db I wonder if anybody knows how I can do that.


回答1:


The cause of your problem is that the value of the permits attribute is badly formatted. You have a string rather than an object.

Change:

"{db: ['TEL', 'PPT',]}"

With:

{"db": ["TEL", "PPT"]}

Please note that if your JSON is not formatted correctly (see JSON specification), it will be automatically turned by CouchDB admin interface into a string. Therefore remember:

  • to use double quotes around object keys,
  • to use double quotes around object values,
  • not to use a comma at the end of an array.


来源:https://stackoverflow.com/questions/41828832/how-to-access-fields-of-a-couchdb-document

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