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


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 not change anything.

I have tried logging out what row('milestones') is and this is the result:


I was expecting to see an array. What else is necessary to add an object to an array? How do I make this work?


You need to update document with a document not an array. Your reql should look like this

rethink.table('shifts') .get(shiftId) .update({ milestones: rethink.row('milestones').append({ dateAchieved: "2017-01-01", phaseType: "TEST" }) }) .run(rethinkConnection)

this is because the .append command does not commit data to the database it only returns an in memory modified array


  • Linux command line : edit hacked index files
  • Updating both a ConcurrentHashMap and an AtomicInteger safely
  • How do I signal completion of my dataflow?
  • c# open webrowser in many tab
  • WPF Visiblity Binding to Boolean Expression with multiple Variables
  • revitapi ironpython ToRoom returns “indexer # object”
  • Access variable of ScriptContext using Nashorn JavaScript Engine (Java 8)
  • Connect .sks to skscene.h
  • Debug.DrawLine not showing in the GameView
  • GridView breaks while scrolling
  • Jackson Parser: ignore deserializing for type mismatch
  • How to Cache Real-time Data?
  • How to use RequestBodyAdvice
  • Python urlparse: small issue
  • How to avoid particles glitching together in an elastic particle collision simulator?
  • Q promise. Difference between .when and .then
  • Display issues when we change from one jquery mobile page to another in firefox
  • Deselecting radio buttons while keeping the View Model in synch
  • How to make a tree having multiple type of nodes and each node can have multiple child nodes in java
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Spray.io: When (not) to use non-blocking route handling?
  • Incrementing object id automatically JS constructor (static method and variable)
  • Does CUDA 5 support STL or THRUST inside the device code?
  • Modifying destination and filename of gulp-svg-sprite
  • Perl system calls when running as another user using sudo
  • JSON with duplicate key names losing information when parsed
  • When should I choose bucket sort over other sorting algorithms?
  • Hazelcast - OperationTimeoutException
  • To display the title for the current loaction in map in iphone
  • Jquery - Jquery Wysiwyg return html as a string
  • Akka Routing: Reply's send to router ends up as dead letters
  • GridView Sorting works once only
  • SVN: Merging two branches together
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • AT Commands to Send SMS not working in Windows 8.1
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How do I configure my settings file to work with unit tests?
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • Is it possible to post an object from jquery to bottle.py?