Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 651 Bytes

File metadata and controls

37 lines (29 loc) · 651 Bytes
layout language permalink command io related_commands
api-command
JavaScript
api/javascript/object/
object
r
object
coerceTo merge keys
coerce_to/
merge/
keys/

Command syntax

{% apibody %} r.object([key, value,]...) → object {% endapibody %}

Description

Creates an object from a list of key-value pairs, where the keys must be strings. r.object(A, B, C, D) is equivalent to r.expr([[A, B], [C, D]]).coerceTo('OBJECT').

Example: Create a simple object.

r.object('id', 5, 'data', ['foo', 'bar']).run(conn, callback)

Result:

{data: ["foo", "bar"], id: 5}