rethinkdb-javascript

How do I get the rank / row number for a row?

喜欢而已 提交于 2019-12-24 15:01:14
问题 Is there a way to get the row numbers (rank) for a filtered set and append the row number to the result? An example scenario would be that I have a table with records like: [ { points: 123, name: 'Glenn' }, { points: 948, name: 'Bob' }, { points: 22, name: 'Sarah' } ] In the above table there are hundreds of thousands of rows, and I want to be able to rank all records based on a condition like points descending and then return a subset of the rows (using a filter) with their rank value

How to create, update, or append a nested document

纵饮孤独 提交于 2019-12-13 06:13:54
问题 I am new to rethinkdb and I'm working on an admin tool for a game server in which I need to record player kills and deaths. I have the following structure for a player in which "name" is a secondary index: "name": NameofPlayer, "sessions:" [ { "id": IDofSession, "kills": NumberofKills, "deaths": NumberofDeaths, "hskr": HSKR%, "weapons": [ { "name": WeaponName, "kills": NumberofKills, "headshots": NumberofHeadshots }, ] }, ] I get the current session id from the server and an event fires on a

Why can't I append an object to an array in rethinkdb?

二次信任 提交于 2019-12-13 02:57:39
问题 I am trying to append an object into an array in rethink . Here is how I am trying to append it: rethink.table('shifts') .get(shiftId) .update(row => row("milestones").default([]).append({ dateAchieved: "2017-01-01", phaseType: "TEST" })).run(rethinkConnection) The error I get is this: first_error: 'Inserted value must be an OBJECT (got ARRAY):\n[\n\t{\n\t\t"dateAchieved":\t"2017-01-01",\n\t\t"phaseType":\t"TEST"\n\t}\n]', I also tried the same code about, but removed .default([]) , which did

RethinkDB: Javascript - How to deleted nested objects

我的未来我决定 提交于 2019-12-12 13:17:34
问题 I'm having a rather large amount of difficulty with trying to remove nested objects from my table, without accidentally deleting all my data in the process (happened three times now, thank god I made copies). My Object: { "value1": thing, "value2": thing, "value3": thing, "roles": { "1": { "name": "Dave", "id": "1" }, "2": { "name": "Jeff", "id": "2" }, "3": { "name": "Rick", "id": "3" }, "4": { "name": "Red", "id": "4" } } }` I've tried a number of rethink queries, but none have worked thus

Rethink DB Cross Cluster Replication

岁酱吖の 提交于 2019-12-11 10:59:51
问题 I have 3 different pool of clients in 3 different geographical locations. I need configure Rethinkdb with 3 different clusters and replicate data between the (insert, update and deletes). I do not want to use shard, only replication. I didn't found in documentation if this is possible. I didn't found in documentation how to configure multi-cluster replication. Any help is appreciated. 回答1: I think that multi cluster is just same a single clusters with nodes in different data center First, you

rethinkdb - hasFields to find all documents with multiple multiple missing conditions

邮差的信 提交于 2019-12-11 05:44:55
问题 I found an answer for finding all documents in a table with missing fields in this SO thread RethinkDB - Find documents with missing field, however I want to filter according to a missing field AND a certain value in a different field. I want to return all documents that are missing field email and whose isCurrent: value is 1 . So, I want to return all current clients who are missing the email field, so that I can add the field. The documentation on rethink's site does not cover this case.