1

我是 CouchDB 的初学者,在网上我读到可以使用 HTTP 请求运行 Mango 查询。我已经很努力了,但我无法处理这样的查询。

这是命令

C:\>curl -X POST http://root:root@127.0.0.1:5984/movielens/_find -d @query.json
{"error":"bad_content_type","reason":"Content-Type must be application/json"}

这是 json 文件的主体:

{"selector": { "Genres": {"$elemMatch": {"$eq": "Drama"}}}}

据我了解,我不知道我错在哪里。那么,我该如何运行这个查询呢?

4

1 回答 1

0

您需要将Content-Type 标题中的 设置为application/json

尝试这个: curl -X POST http://root:root@127.0.0.1:5984/movielens/_find --header 'Content-Type: application/json' -d @query.json

于 2020-04-28T10:56:14.170 回答