Questions tagged [rethinkdb-javascript]

JavaScript driver for RethinkDB

JavaScript driver for RethinkDB.

197 questions
0
votes
1 answer

RethinkDB: Check if object in array exist and replace it

I have this JSON document: { userId: xx, followedAuthors: [ { authorId: abc, timestamp: 123 }, { authorId: xyz, timestamp: 456 }, ] } When a user want to follow an author I would like to write a query that check if that author is…
Tres
  • 571
  • 1
  • 5
  • 19
0
votes
1 answer

How to update item conditionally with branch in RethinkDB

I am trying to do simple upsert to the array field based on branch condition. However branch does not accept a reql expression as argument and I get error Expected type SELECTION but found DATUM. This is probably some obvious thing I've missed,…
xb1itz
  • 1,022
  • 10
  • 17
0
votes
1 answer

RethinkDB replace document but not specific property

I would like to apply in one query a document replacement but i would like to keep a specific property (createdAt) from the old document. The old document : {id: "xxx" title: "my title", description: "my desc", createdAt: "1507844981006"} The new…
Cédric
  • 401
  • 3
  • 9
0
votes
1 answer

rethinkdb response is both true and false

I'm trying to check if a value exists in my rethinkdb table. It seams like its giving 2 responses. I do it this way: router.param('gamename', function(req, res, next, gamename) { // do validation on gamename here console.log(gamename); …
Bolli
  • 4,974
  • 6
  • 31
  • 47
0
votes
1 answer

RethinkDB - how to get a single document by query?

How can I get one document only by query in RethinkDB? for an example, I want to get the document by this query below: let searchQuery = { name: 'rob' } var cursor = await r.table('users').filter(searchQuery).run(connection) var user =…
Run
  • 54,938
  • 169
  • 450
  • 748
0
votes
1 answer

how do I filter rethinkdb table column (object array) based on 2 values

I am trying to filter a rethinkdb table (conversations) which contains nested object array called participants. The structure is below. I am trying to execute a query that selects conversations based on the IDs of the participants. in plain…
Neo
  • 717
  • 2
  • 11
  • 26
0
votes
1 answer

Is there a way to listen to a special event when RethinkDB reconnects?

I'm using a NodeJS application with a RethinkDB database. When i start the server the application establish a connection with Rethink and it starts to listen to the changes in a table using RethinkDB feeds. The problem is when RethinkDB goes down.…
user6655656
0
votes
1 answer

Rethinkdb Use existing value if branch evaluates to false

Using branch update logic in rethinkdb. I am needing to update a value based on wether another value matches and then set the appropriate value. If the values are the same it should use the existing…
ckross01
  • 1,681
  • 2
  • 17
  • 26
0
votes
1 answer

How to find a particular object in a array

How to find a particular object in a array. Below is my code r.table("tablename").filter( function(doc){ return r.expr(["value1","value2"]); });
Govind Jha
  • 123
  • 2
  • 9
0
votes
3 answers

Join in RethinkDB

How to Join with multiple conditions and use aggregate function in Rethink-db r.table("yourtable").get(id).innerJoin( r.table("secondtable"),function (up, upp) { return user_profile("mID") }).map({ uId: r.row("left")("userId"), …
Govind Jha
  • 123
  • 2
  • 9
0
votes
1 answer

RethinkDB generic repository in typescript, return promise result from method

I'm trying to write a RethinkDB generic repository in typescript. I saw that RethinkDB javascript returns promises, I'd like to, for example in GetAll method, return the array items. For the moment I wrote something like this: public GetAll(): T[]…
0
votes
1 answer

updating an array of nested documents rethinkdb

I have a document schema like this: { "name":"", "type":"", "posts":[ { "url":"", "content":"", ... }, { "url":"", "content":"", ... } ... ] }... I forgot to create id's for each post on insertion in database. So i'm trying to create a query for…
scroobius
  • 662
  • 2
  • 7
  • 25
0
votes
1 answer

How Should Complex ReQL Queries be Composed?

Are there any best practices or ReQL features that that help with composing complex ReQL queries? In order to illustrate this, imagine a fruits table. Each document has the following structure. { "id": 123, "name": "name", "colour":…
Chris Talman
  • 1,059
  • 2
  • 14
  • 24
0
votes
1 answer

Order changed after distinct() : RethinkDb Javascript

I am working with the Reql, the problem i am facing is that i need to filter the same plucked values in correct order. After pluck and distinct() apply, value are correct but not in correct order, their order lost. Sample…
Suhail Mumtaz Awan
  • 3,295
  • 8
  • 43
  • 77
0
votes
1 answer

Rethinkdb: Query to get items from the last 24 hours from a big table

I have a table in RethinkDB consisting of 3 millions tweets. Each field has an epoch time, when it was inserted. What javascript query could I make to get quickly the tweets from the last 24 hours (roughly about 50k) sorted by keyword? I tried…
crisscross
  • 1,675
  • 2
  • 18
  • 28