I didn't want to give you any confidential information, so I created a new client document. Well, now the query works and returns all the client documents. What happened?
- Matt -----Original Message----- From: Garren Smith [mailto:gar...@apache.org] Sent: Thursday, August 24, 2017 2:00 PM To: user@couchdb.apache.org Subject: Re: Mango query with $eq operator returns no results, but $regex does Could you supply some example docs so I can try and reproduce it. On Thu, 24 Aug 2017 at 8:07 PM Matt Cosentino <mcosent...@cacorp.com> wrote: > Yes. > > - Matt > > > -----Original Message----- > From: Garren Smith [mailto:gar...@apache.org] > Sent: Thursday, August 24, 2017 12:51 PM > To: user@couchdb.apache.org > Subject: Re: Mango query with $eq operator returns no results, but > $regex does > > Do you have any docs with the field type = client? > > On Thu, 24 Aug 2017 at 7:47 PM Matt Cosentino <mcosent...@cacorp.com> > wrote: > > > Tried that, it is using the type index. Isn't that what I want? > > That's the only field in my selector. > > > > - Matt > > > > > > -----Original Message----- > > From: Garren Smith [mailto:gar...@apache.org] > > Sent: Thursday, August 24, 2017 12:34 PM > > To: user@couchdb.apache.org > > Subject: Re: Mango query with $eq operator returns no results, but > > $regex does > > > > I think the best next step is to run the query against _explain > > instead of _find. It will tell you which index it has selected. > > > > The other option is to add another selector with client_id > null. > > I'm guessing it is choosing the type, customer_name index and you > > want it to use the type, client_id index > > > > On Thu, 24 Aug 2017 at 6:42 PM Matt Cosentino > > <mcosent...@cacorp.com> > > wrote: > > > > > special: _id > > > json: type, client_id > > > json: last_payment > > > json: type > > > json: date > > > json: date, time > > > json: type, client_id, date > > > json: datetime > > > json: client_id > > > json: type, customer_name > > > json: customer_name > > > > > > { selector: { "type": { "$eq": "client" } } } > > > > > > - Matt > > > > > > > > > -----Original Message----- > > > From: Garren Smith [mailto:gar...@apache.org] > > > Sent: Thursday, August 24, 2017 11:00 AM > > > To: user@couchdb.apache.org > > > Subject: Re: Mango query with $eq operator returns no results, but > > > $regex does > > > > > > Can you give me a full list of all your indexes and the query you > > > are running. > > > > > > On Thu, 24 Aug 2017 at 5:45 PM Matt Cosentino > > > <mcosent...@cacorp.com> > > > wrote: > > > > > > > Ugraded to 2.1, still get no results, and now get no results for > > > > the $regex query as well. If I do a query of $gt null, the > > > > results I'm looking for are there. > > > > > > > > - Matt > > > > > > > > > > > > -----Original Message----- > > > > From: Matt Cosentino [mailto:mcosent...@cacorp.com] > > > > Sent: Thursday, August 24, 2017 9:41 AM > > > > To: user@couchdb.apache.org > > > > Subject: RE: Mango query with $eq operator returns no results, > > > > but $regex does > > > > > > > > I have an index created for "type". > > > > > > > > { > > > > "type": "json", > > > > "def": { > > > > "fields": [ > > > > { > > > > "type": "asc" > > > > } > > > > ] > > > > } > > > > } > > > > > > > > I'll try upgrading my test server to 2.1 and see if that helps, > thanks. > > > > > > > > - Matt > > > > > > > > > > > > -----Original Message----- > > > > From: Garren Smith [mailto:gar...@apache.org] > > > > Sent: Thursday, August 24, 2017 4:38 AM > > > > To: user <user@couchdb.apache.org> > > > > Subject: Re: Mango query with $eq operator returns no results, > > > > but $regex does > > > > > > > > Hi Matt, > > > > > > > > What are your indexes? Also could you try these queries on > > > > CouchDB > 2.1. > > > > The index selector was improved significantly in 2.1 to avoid > > > > these types of issues. > > > > > > > > Cheers > > > > Garren > > > > > > > > On Wed, Aug 23, 2017 at 9:49 PM, Matt Cosentino > > > > <mcosent...@cacorp.com> > > > > wrote: > > > > > > > > > This is very strange. I have a very simple query: > > > > > > > > > > { selector: { "type": { "$eq": "client" } } } > > > > > > > > > > This returns no results, but there are documents with a type > > > > > value of client, and the index exists. > > > > > > > > > > I try other values in the query and they all work. > > > > > > > > > > I try this query instead: > > > > > > > > > > { selector: { "type": { "$regex": "client" } } } > > > > > > > > > > This gives me the results I expect. Why? > > > > > > > > > > Here's another strange thing. I have another version of my > > > > > database on another server. I run the original query there and > > > > > it works. Both servers are running version 2.0 of CouchDB. > > > > > Does anyone have any idea what could be wrong? > > > > > > > > > > > > > > > - Matt > > > > > > > > > > > > > > > > > > > >