Code Monkey home page Code Monkey logo

Comments (7)

 avatar commented on June 1, 2024

So I'm guessing that {} works for the simple case as { comes after 1-9A-Z-z e.t.c in the standard ASCII table.

But when using a JSON object as a key the opening brace matches the serialised key value and therefore excludes any row where a second key is defined.

So it seems that as you suggest, the simplest solution for me is to flatten my objects to simple properties, thereby removing the {} in the serialised key string and so allowing the basic string matching algorithm to work as expected.

But it would be useful to understand what couchbase server supports in respect to complex JSON objects as keys and eventually align couchbase-lite with that.

I have looked at the docs but they make no explicit statement about JSON objects for keys, I'll post there and see what response I get.

I'd be happy to look at patching CBL to align with couchbase server if necessary.

from couchbase-lite-ios.

 avatar commented on June 1, 2024

Re-visiting the documentation for couchbase server, I found the following statements:

The key can be formatted in a variety of ways, including as a string or compound value (such as an array or JSON object). The content and structure of the key is important, because it is through the emitted key structure that information is selected within the view.

From one perspective it would seem make sense for CBL to support the same key types as couchbase server, but I appreciate that there may be reasons why this is not seen as desirable for CBL.

from couchbase-lite-ios.

snej avatar snej commented on June 1, 2024

There’s a custom SQLite comparator defined for that table column, which knows how to compare JSON values. (See CBLCollateJSON.m.)

IIRC it compares object properties in the order they appear in the respective objects, so unless the ordering is alphabetical it won’t give the right results. And I don’t think I’m canonicalizing the JSON stored in the database.

from couchbase-lite-ios.

jchris avatar jchris commented on June 1, 2024

I think what you see here is a limitation in the design of the collator. There is no sentinel value greater than {}.

Maybe an endkey like {"\ufff0":"\ufff0"}

from couchbase-lite-ios.

liufsd avatar liufsd commented on June 1, 2024

i also have same question.
how to query like this :"where c_user_id>10 and c_user_name ='test' " ?

from couchbase-lite-ios.

snej avatar snej commented on June 1, 2024

@79144876: Please ask questions on the mobile-couchbase Google group. This issue tracker is for bug reports and feature requests. Also, please describe your question more clearly; see the advice here.

from couchbase-lite-ios.

liufsd avatar liufsd commented on June 1, 2024

ok .thanks/

from couchbase-lite-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.