rethinkdb

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

suppress output from `clojure.tools.logging`

旧时模样 提交于 2019-12-13 02:11:05
问题 I'm having difficulty hiding the output of clojure.tools.logging a library is using. The library is logging an error and this causes a stacktrace on stderr but it's not an error-level message for me and I can't figure out a way to hide it. I use timbre for my own application so I guess capturing the output and re-logging it as a warning or just a debug would be ideal, but for now I just need the stacktrace noise gone. I've tried rebinding err to out and then nesting the body within a with-out

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

Display table data from RethinkDB in Phoenix Framework

不打扰是莪最后的温柔 提交于 2019-12-12 12:52:28
问题 I'm attempting to display data from my databases in RethinkDB (using the rethinkdb-elixir package from Hamiltop https://github.com/hamiltop/rethinkdb-elixir) in Phoenix. I'm relatively new to both, but I already managed to insert two tables and some data into those tables. I know this because I checked it through RethinkDB's web GUI. Now I want to display table data in an html page of my project. I've reduced the errors to one: protocol Phoenix.HTML.Safe not implemented for %RethinkDB

RethinkDB: iterating over object properties

徘徊边缘 提交于 2019-12-12 08:34:46
问题 I have the following data structure: wall { slug: "wall-slug", nodes: { "node1": "id-from-nodes-table-1", "node2": "id-from-nodes-table-2" } } nodes { id: "id-from-nodes-table-1", something: "something" } Trying to merge document from nodes table into definite node in nodes object in wall table in this way: r.db("test").table("walls").getAll("wall-slug", {index: "slug"}).map(function(row) { return row.merge({nodes: row("nodes").map(function(node) { return r.db("test").table("nodes").get(node)

Rethinkdb atomic retrieve and update

和自甴很熟 提交于 2019-12-12 04:56:50
问题 Say I have the following data structure: { "name": "i1", "time": 1, "status": 1} { "name": "i2", "time": 2, "status": 1} { "name": "i3", "time": 3, "status": 1} { "name": "i4", "time": 4, "status": 2} I need to retrieve the item with the largest time and "status" = 1. Then update it's "status" to 2, all this atomically, so the same item can't be retrieved by other consumer in the same time. Is this possible with rethinkdb ? 回答1: Since atomicity in RethinkDB is only guaranteed on a per

Java RethinkDB Expected type DATUM but found SELECTION

点点圈 提交于 2019-12-12 03:47:38
问题 I'm using RethinkDB driver for Java. I want to filter the rows without field endedAt in table jam like this: public List<Jam> getCurrent(){ Cursor cursor = r.table("jam") .filter(row -> row.hasFields("endedAt")).not() .run(conn); List<Map<String,Object>> list=cursor.toList(); return list.stream().map(item->JamRepository.toJam(item)).collect(Collectors.toList()); } And I've got this error Expected type DATUM but found SELECTION Java I have another filter function in another class: public List

RethinkDB Compound Index Weirdness Using Between

元气小坏坏 提交于 2019-12-12 03:36:15
问题 I've noticed something strange with compound indexes in the between function in RethinkDB. It seems to retrieve results that don't match the query. It's all detailed below. r.dbCreate('test') r.db('test').tableCreate('numbers') r.db('test').table('numbers').insert([ { first: 1, second: 1 }, { first: 1, second: 2 }, { first: 1, second: 3 }, { first: 1, second: 4 }, { first: 1, second: 5 }, { first: 2, second: 1 }, { first: 2, second: 2 }, { first: 2, second: 3 }, { first: 2, second: 4 }, {

How to perform initial setup in koa with rethinkdb

痞子三分冷 提交于 2019-12-11 23:07:27
问题 Im using rethinkdbdash with koa and trying to figure out how to perform a set up of the database when the app first starts. Im trying to accomplish something similar to Segphalt's cats of instagram tutorial but using koa. var conn; r.connect(config.database).then(function(c) { conn = c; return r.dbCreate(config.database.db).run(conn); }) .then(function() { return r.tableCreate("instacat").run(conn); }) .then(function() { return q.all([ r.table("instacat").indexCreate("time").run(conn), r

rethinkdb PHP-RQL changes

痞子三分冷 提交于 2019-12-11 19:45:52
问题 I'm using PHP-RQL library to work with RethinkDB, i need to get changes when new data inserted. but i'm getting PHP Fatal error: Uncaught RqlDriverError: Options must be an array. in api documentation its says: table->changes(array('squash' => true, 'include_states' => false)) → stream singleSelection->changes(array('squash' => true, 'include_states' => false)) → stream Return an infinite stream of objects representing changes to a query. Example: Subscribe to the changes on a table. r\table(