Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mango Query won't run on _users database #535

Closed
fahidRM opened this issue May 22, 2017 · 14 comments
Closed

Mango Query won't run on _users database #535

fahidRM opened this issue May 22, 2017 · 14 comments

Comments

@fahidRM
Copy link

fahidRM commented May 22, 2017

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

@mraygalaxy
Copy link

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

Help. 😄

@mraygalaxy
Copy link

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:https://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

@wohali
Copy link
Member

wohali commented May 22, 2017

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

@wohali
Copy link
Member

wohali commented May 22, 2017

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">>]

@janl
Copy link
Member

janl commented May 23, 2017

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

@fahidRM
Copy link
Author

fahidRM commented May 23, 2017

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

@wohali
Copy link
Member

wohali commented May 23, 2017

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

@noslon
Copy link

noslon commented Jun 16, 2017

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?

@wohali
Copy link
Member

wohali commented Jun 16, 2017

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

@noslon
Copy link

noslon commented Jun 16, 2017

@wohali Okay thanks. Do you may know an alternative solution to find specific user data without a specific GET request to http:https://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.

@mraygalaxy
Copy link

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?

@noslon
Copy link

noslon commented Jun 17, 2017

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

@ptitjes
Copy link

ptitjes commented Nov 16, 2017

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

@mraygalaxy
Copy link

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

nickva pushed a commit to nickva/couchdb that referenced this issue Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants