############
Writing Data
############
------
insert
------
Insert documents into a table. Accepts a single document or an array of documents.
The optional arguments are:
* durability: possible values are hard and soft. This option will override the table or query"s durability setting (set in run). In soft durability mode RethinkDB will acknowledge the write immediately after receiving it, but before the write has been committed to disk.
* return_vals: if set to True and in case of a single insert/upsert, the inserted/updated document will be returned.
* upsert: when set to True, performs a replace if a document with the same primary key exists.
Insert returns an object that contains the following attributes:
See the doc of the returned :java:ref:`DMLResult` for a description of the attributes returned.
see `Python Doc `_ for full capabilites
.. code-block:: java
DMLResult result = r.rable("test").insert(
new MapObject().with("name", "Jack"),
new MapObject().with("name", "Jill")
).run(connection);
result.getInserted() // = 2
signatures:
.. code-block:: java
public Insert insert(Map dbObject, Durability durability, Boolean returnVals, Boolean upsert);
public Insert insert(Map... dbObject);
public Insert insert(List