Code Monkey home page Code Monkey logo

Comments (4)

apa512 avatar apa512 commented on September 16, 2024

Getting a cursor is actually the expected outcome, though I agree it's not very intuitive. Cursors implement Seqable so you can for example turn it into a vector with into [] or use take to avoid loading the entire result set.

Examples are very lacking and I'm too lazy to write them. Perhaps the best way for now is to look at the tests.

from clj-rethinkdb.

jwr avatar jwr commented on September 16, 2024

Oh. Sorry — I read the RethinkDB tutorial on table joins and they show the pretty {"left": {...}, "right": {...}} output, without mentioning a cursor once. It turns out that one can learn about cursors by digging deeper into JavaScript API documentation.

I did look at the tests, but for example for indexes they also only contain a fairly simple example of an index created using a custom function.

Like I said, I'm willing to do some work on this, but I can't find a good way to get started. I've been banging my head against a wall for a while now, and the only way forward that I can see is to start back from the JSON protocol and work back through the code from there, trying to figure out what the Clojure form of rdb commands is. Can you suggest a better approach?

from clj-rethinkdb.

apa512 avatar apa512 commented on September 16, 2024

The client is pretty much a direct mapping of the underlying JSON protocol so I guess https://github.com/rethinkdb/rethinkdb/blob/v2.0.x/src/rdb_protocol/ql2.proto could be useful. Either that or reading query.clj.

The same functions are used for creating indexes and querying, so the syntax for creating a secondary index on a nested field is the same as get on a nested field.

Is there anything else you've been having trouble with?

from clj-rethinkdb.

jwr avatar jwr commented on September 16, 2024

No, thanks — I'm figuring things out from the ground up and making progress. I will probably make a pull request in a while, with expanded examples, so that others have an easier start. I think this issue can be closed.

BTW, the idea that I should get a structure with "left" and "right" fields was from a RethinkDB tutorial, this is why I was surprised that I got a cursor. That cursor additionally explodes in your face once it goes out of (with-open) connection scope, so it's a double whammy.

from clj-rethinkdb.

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.