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

Filtering on numeric values fails #2

Closed
timjacobi opened this issue Feb 9, 2016 · 7 comments
Closed

Filtering on numeric values fails #2

timjacobi opened this issue Feb 9, 2016 · 7 comments
Labels

Comments

@timjacobi
Copy link

Model configuration (simplified)

{
  "name": "Record",
  "base": "PersistedModel",
  "idInjection": true,
  "options": {
    "validateUpsert": true
  },
  "properties": {
    "sharedKey": {
      "type": "string",
      "description": "Unique ID",
      "required": true
    }
    ...
  },
  ...
}

Retrieving all records

GET https://myhost/api/Records

[
  {
    "sharedKey":"12345",
    "id":"0266cb32b2afd1d6ea7760ab54981f49",
    "_rev":"2-4cb556a75312172c7730ecbdafb1cd1e"
  },
  {
    "sharedKey":"aString",
    "id":"33c6ca3d10aff422f697322bd1cfddab",
    "_rev":"2-ff30b9a96e4aba1ae36cca785baad2e5"
  }
]

Filtering on the value aString returns the expected document

GET https://myhost/api/Records?filter[where][sharedKey]=aString

[
  {
    "sharedKey":"aString",
    "id":"33c6ca3d10aff422f697322bd1cfddab",
    "_rev":"2-ff30b9a96e4aba1ae36cca785baad2e5"
  }
]

Filtering on the value 123456 returns nothing

GET https://myhost/api/Records?filter[where][sharedKey]=123456

[]
@tonyffrench
Copy link
Contributor

@timjacobi seems to be a corner case using Cloudant Query. Running the following query directly against the DB produces the same result:

{
    "selector": {
        "loopback__model__name": "Record",
        "sharedKey": "12345"
    },
    "use_index": ["lb-index-ddoc-Record", "lb-index-Record"],
    "sort": [{
        "id:string": "asc"
    }]
}

I'll take this up with the Cloudant team.

@jmereaux
Copy link

jmereaux commented Mar 3, 2016

+1

@tonyffrench
Copy link
Contributor

Cloudant team has already produced a fix for this issue and it will be rolling out soon. I'm currently testing against an internal cluster and all looks good.

@timjacobi
Copy link
Author

Super. Thanks for doing the correspondence and testing. Is the issue in cloudant tracked publicly?

@srinivas-os
Copy link

I have this issue as well. How can I get the fix? Should I update cloudant or the connector or both?

@tonyffrench
Copy link
Contributor

@srinivas-os the fix requires a new version of the Cloudant server. The Cloudant team are working on rolling out the fix, I spoke with them last week on the progress. Thanks for your patience.

@tonyffrench
Copy link
Contributor

I've just confirmed this is now fixed with Cloudant version {"couchdb":"Welcome","version":"1.0.2","cloudant_build":"2579"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants