Couchdb: Mango Query won't run on _users database

Created on 22 May 2017  路  14Comments  路  Source: apache/couchdb

I have been trying to run a Mango Query on the _users database using Fauxton but the process seems unfruitful and yields either of the errors below;
i. vacc
ii. case_clause

Currently, I have an index on both the name and _id field

bug mango

Most helpful comment

@ptitjes This is working for me now on version 2.1.1. Thanks guys!

All 14 comments

Confirmed. I was hoping for regex ability on the _users database.

Help. 馃槃

Neither the default query against _id in the Fauxton UI or a contructed query on the command line via CURL work with the following error:

$ curl -X POST -H "Content-Type: application/json" "http://172.17.0.1:5984/_users/_find" -d '{"selector" : {"name" : {"$eq" : "demo"}}}'

Results in:

{"error":"unknown_error","reason":"case_clause","ref":1948008234}

With the following in the couch log:

[error] 2017-05-22T22:34:06.233386Z [email protected] <0.966.0> 4bd8b22f4b req_err(1948008234) unknown_error : case_clause
[<<"mango_cursor_view:doc_member/3 L245">>,<<"mango_cursor_view:handle_message/2 L154">>,<<"fabric_view:maybe_send_row/1 L132">>,<<"rexi_utils:process_mailbox/6 L55">>,<<"fabric_view_all_docs:go/6 L107">>,<<"fabric_view_all_docs:go/5 L32">>,<<"mango_cursor_view:execute/3 L91">>,<<"mango_httpd:handle_find_req/2 L185">>]
[notice] 2017-05-22T22:34:06.235416Z [email protected] <0.966.0> 4bd8b22f4b 172.17.0.1:5985 172.17.0.1 undefined POST /_users/_find 500 ok 66

Still fails on master:

[error] 2017-05-22T22:56:34.425168Z [email protected] <0.7789.0> 03fee44bca req_err(3984724726) unknown_error : case_clause
    [<<"mango_cursor_view:doc_member/3 L271">>,<<"mango_cursor_view:handle_message/2 L171">>,<<"fabric_view:maybe_send_row/1 L132">>,<<"rexi_utils:process_mailbox/6 L55">>,<<"fabric_view_all_docs:go/6 L112">>,<<"fabric_view_all_docs:go/5 L32">>,<<"mango_cursor_view:execute/3 L92">>,<<"mango_httpd:handle_find_req/2 L185">>]
[notice] 2017-05-22T22:56:34.425681Z [email protected] <0.7789.0> 03fee44bca localhost:15984 127.0.0.1 undefined POST /_users/_find 500 ok 12

After creating an index, you get the aforementioned badrecord : vacc error:

[error] 2017-05-22T23:22:03.877980Z [email protected] <0.17275.0> 81bbcf9c62 req_err(3408688270) badrecord : vacc
    [<<"fabric:query_view/6 L343">>,<<"mango_cursor_view:execute/3 L98">>,<<"mango_httpd:handle_find_req/2 L185">>,<<"mango_httpd:handle_req/2 L37">>,<<"chttpd:process_request/1 L295">>,<<"chttpd:handle_request_int/1 L231">>,<<"mochiweb_http:headers/6 L122">>,<<"proc_lib:init_p_do_apply/3 L237">>]

_users is governed by a special permissions system. What happened when you make the request as an admin user?

While trying to run Mango Query, I was logged in as an admin.

And my tests were in admin party, @janl...

Have the same problem, can't run a Mango Query on the _users database.

{ "error": "unknown_error", "reason": "case_clause", "ref": 1948008234 }

What is the current status of this issue?

Current status is the ticket is open and no one has picked it up yet.

@wohali Okay thanks. Do you may know an alternative solution to find specific user data without a specific GET request to http://127.0.0.1:5984/_users/org.couchdb.user:USERNAME ?

For e.g. I have users which also have their email address in the document. If a user can't remember the password I would like to send them a new one. But for this I need to find the user with the provided email address, change the password and send it (via email) to the user.

I'm thinking about replicating the user database to a read-only copy database and performing the query that way.........

That should work right until someone picks up this ticket?

@hinesmr This could be a solution, I'll try that. Thanks!

@nickva This issue is not fixed. Could you please reopen ?

@ptitjes This is working for me now on version 2.1.1. Thanks guys!

Was this page helpful?
0 / 5 - 0 ratings