Questions tagged [reql]

ReQL is the RethinkDB query language. It offers a convenient way to manipulate JSON documents.

ReQL is the RethinkDB query language. It offers a convenient way to manipulate JSON documents.

http://www.rethinkdb.com/docs/introduction-to-reql/

99 questions
1
vote
1 answer

How can I upsert a document in rethinkdb (reql) by an arbitrary property?

I have an .itemId which comes from a 3rd party, not generated by me. I need to look for it in the db and update or insert it if one doesn't exist. I've tried using this example from the cookbook:…
chovy
  • 72,281
  • 52
  • 227
  • 295
1
vote
0 answers

RethinkDB: how can I query nested arrays?

I have a person object in RethinkDB that looks like this: { "email": "user@domain.com", "orders": {, "id": 1, "additionalInvoices": [ { "description": "Bananas", "stripeChargeId": "ch_333" }, { …
mikemaccana
  • 110,530
  • 99
  • 389
  • 494
1
vote
1 answer

Primary key too long with eqJoin in RethinkDB

I am trying to use joins in RethinkDB in a simple way. This is the query I tried, like shown in the docs: r.table('users')('inventory').default([]).eqJoin('name', r.table('prices')).without({ right: 'name' }).zip() I have an item list for each…
Maarethyu
  • 83
  • 1
  • 9
1
vote
2 answers

How to generate a RethinkDB changefeed for all tables in a database

I'm testing an API which inserts or deletes data in multiple tables of a RethinkDB database. In order to monitor what is happening to the database while using the API, I would like to print the changes in all its tables. Here is some 'pseudo-code'…
Kurt Peek
  • 52,165
  • 91
  • 301
  • 526
1
vote
1 answer

Query to update nested array item without knowing the index

I have a table that contains complex nested documents. The structure of each document is similar to the following example: { "description": "Sample Document", "events": [ { "liquids": { ... }, "protocol": { "id":…
Luke
  • 5,567
  • 4
  • 37
  • 66
1
vote
0 answers

Optimize query with filter and orderBy

I have a table Items with ~20k records. I need to be able to filter on multiple tags (or) and maintain order of the items, sorted by sticky then created-date. For example I may fetch items tagged with tagA, tagB or tagC etc. If an item is sticky…
nifty
  • 45
  • 4
1
vote
0 answers

RethinkDB: JOIN with dynamic property/field names

The solution to this RethinkDB query has eluded me for days now. Does not help that I'm a t-SQL developer... Given a document structure like this: var messages = { "Category A" : { catName: 'Category A', …
MojoDBA
  • 118
  • 7
1
vote
1 answer

Upsert & increment in RethinkDB

Is it possible to do an "upsert" with an increment? So if the query is an insert the counter will initialize with 1 and if it an update it will increment the counter by 1
gmadar
  • 1,884
  • 3
  • 19
  • 22
1
vote
1 answer

Rethinkdb remove string from array

Given an array and data structure as below, I want to remove any values that match from the removeVals from the table field tags. I've found a solution for changing, and tried with the deleteAt, but got an indexesOf is not a function error. var…
1
vote
1 answer

Use result from another query in filter in RethinkDB/ReQL

Any idea how can I select the Agent IDs inside the clients filter? This is what I have now and it works, but I do not like that first we are waiting for the Agents to be selected and then we do another trip to the database to select the clients. Is…
Ivo Sabev
  • 5,230
  • 1
  • 26
  • 38
1
vote
1 answer

Doing an update instantly after read

Suppose I have multiple instances of an app reading a single row with a query like the following r.db('main'). table('Proxy'). filter(r.row('Country').eq('es').and(r.row('Reserved').eq(false))). min(r.row('LastRequestTimeMS')) the 'Reserved' field…
Bread
  • 423
  • 5
  • 16
1
vote
1 answer

Update randomly selected item if it exists in RethinkDB

I want to randomly select a single item from a collection of 0 to many items and if it exists, update a specific field. If the item does not exist, I'd like the function to perform no update and return null. My current REQL…
mark
  • 1,953
  • 1
  • 24
  • 47
1
vote
0 answers

how can i make fast queries to this documents or model it better so that it can be faster in rethinkdb

I have the need to store modems and messages and associate them so that first they are just saved as new, not associated to any modem, when it comes to routing each message I have to first query which connected modem has sent the most messages to…
Jose Andradez
  • 37
  • 2
  • 9
1
vote
1 answer

SQL to REQL how to?

I'm new to Reql and i'm trying to figure out how to transform my simple Sql request to Reql (i'm using python with rethinkdb) Select id, min(value), max(value), avg(value) From mytable Group by id Having timestamp between '2003-12-05T15:01:00.05Z'…
BitFlow
  • 37
  • 6
1
vote
2 answers

ReQL Updating object inside an embedded array emits "create" and "delete" events when listening to changes

I am hitting the following problem: Suppose that I have the following structure: { "id": 1, "data": { "arr": [{"text":"item1"}] } } And the following query: r.db('test').table('test').get(1).update(function (item) { return { …
Georgi-it
  • 3,676
  • 1
  • 20
  • 23