rethinkdb

is there any way where i can apply group and pagination using createQuery?

不想你离开。 提交于 2019-12-23 06:27:23
问题 Query like this, http://localhost:3030/dflowzdata?$skip=0&$group=uuid&$limit=2 and dflowzdata service contains data like, [ { "uuid": 123456, "id": 1 }, { "uuid": 123456, "id": 2 }, { "uuid": 7890, "id": 3 }, { "uuid": 123456, "id": 4 }, { "uuid": 4567, "id": 5 } ] Before Find Hook like, if (query.$group !== undefined) { let value = hook.params.query.$group delete hook.params.query.$group const query = hook.service.createQuery(hook.params.query); hook.params.rethinkdb = query.group(value) }

is there any way where i can apply group and pagination using createQuery?

孤街醉人 提交于 2019-12-23 06:27:11
问题 Query like this, http://localhost:3030/dflowzdata?$skip=0&$group=uuid&$limit=2 and dflowzdata service contains data like, [ { "uuid": 123456, "id": 1 }, { "uuid": 123456, "id": 2 }, { "uuid": 7890, "id": 3 }, { "uuid": 123456, "id": 4 }, { "uuid": 4567, "id": 5 } ] Before Find Hook like, if (query.$group !== undefined) { let value = hook.params.query.$group delete hook.params.query.$group const query = hook.service.createQuery(hook.params.query); hook.params.rethinkdb = query.group(value) }

RethinkDB Survey Modelling

℡╲_俬逩灬. 提交于 2019-12-23 04:45:07
问题 I'm starting a new project (a survey application) and I chose RethinkDB as my database; however, I have some questions about data modelling. I'm going to have questions that can be answered only once by each user. Moreover I'll have reports that will tell the percentage of users that chose each option. At first I thought of the following modelling: { title: String, total_answers: Number, options: [{ value: Number, label: String, respondents: [User IDs] }] } The problem is that RethinkDB

Rethinkdb removing data from documents

天大地大妈咪最大 提交于 2019-12-22 12:44:10
问题 I'm trying to remove some portions of data from documents with given fairly simple structure, which will get much deeper and heavier than this as the project goes: { id: "...", name: "...", phone: "...", data: { key1: "val1", ... } ... } I'm aware that there is no way of updating/removing sections from the nested parts other than replacing the whole tree with updated tree. For example, if I want to delete key1 from document data, I need to update the documents data section with a copy of it

Querying array of nested objects

南楼画角 提交于 2019-12-22 04:17:22
问题 Say I have this JSON (sample - a real-life example can be found at apple itunes rss feed) stored in a RethinkDB table called 'test': { "feed": { "entry": [ { "title": { "label": "Some super duper app" }, "summary": { "label": "Bla bla bla..." } }, { "title": { "label": "Another awsome app" }, "summary": { "label": "Lorem ipsum blabla..." } } ] } } How would I write a ReQL query in JavaScript in order to fetch the summary of all entries ( entry ) which have title containing the string "xyz"? I

How to force binding re-evaluate or re-rendering in Aurelia

前提是你 提交于 2019-12-20 12:23:36
问题 I am starting with a simple TODO app with Aurelia, RethinkDB & Socket.IO. I seem to have problem with re-rendering or re-evaluating an object that is changed through Socket.IO. So basically, everything works good on the first browser but doesn't get re-rendered in the second browser while displaying the object in the console does show differences in my object. The problem is only on updating an object, it works perfectly on creating/deleting object from the array of todo items. HTML <ul> <li

How does RethinkDB generate auto ids?

被刻印的时光 ゝ 提交于 2019-12-20 04:29:05
问题 I'm writing a script which supposed to merge some data from sql-based db. Each row has a long-integer as a primary key (incremental). I was thinking about hashing these ids so that they'll somehow 'look' like the other ids already in my RethinkDB table. What I'm trying to achive here is to avoid dups in case of an attempt to merge the same data again, but keeping the original integers as ids along with the generated ids of the data saved directly to RethinkDB's table feels weird. Can I do

rethinkdb check if record exists

浪尽此生 提交于 2019-12-13 08:43:30
问题 Here is an example: r.db('my_db').table('my_table').get('my_record_id_123') The above code works fine, but returns the record. The records in this table are huge. Is there a way to check if the record with that specific id exists or not without returning the record itself ? 回答1: Perhaps this is what you want (it will return true if the record exists or false otherwise): r.db('my_db') .table('my_table') .getAll('my_record_id_123') .count() .eq(1) 回答2: returns number r.db('my_db') .table('my

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

How to extract multiple queries at once in Rethinkdb

空扰寡人 提交于 2019-12-13 03:35:46
问题 I want to do something like: var tab = r.db("test").table("test"); all =[ tab.getAll('1').fitler({'hidden': false}).limit(1), tab.getAll('2').fitler('hidden': false}).limit(1), tab.getAll('3').fitler('hidden': false}).limit(1), ] But when running this query I'm getting: Expected type DATUM but found SELECTION: 回答1: In general, the "Expected type DATUM but found SELECTION" error can be solved by adding .coerceTo('array') : var tab = r.db("test").table("test"); all =[ tab.getAll('1').filter({