hashMap

ReQL command: hashMap

Command syntax

r.hashMap(key, value)[.with(key, value) ...] → object

Description

Take a key/value pair, with extra key/value pairs optionally specified by chaining one or more with(key, value) terms after hashMap, and return an object.

hashMap is a convenience provided by the RethinkDB Java driver, and is not actually a ReQL term. It returns a MapObject, a RethinkDB-provided class that inherits from Map<Object,Object>. You can use hashMap outside the context of a ReQL query.

Example: Create a hashmap.

import com.rethinkdb.model.MapObject;

MapObject newData = r.hashMap("user", "fred")
    .with("email", "fred@example.com")
    .with("id", 101)
    .with("admin", true);

This creates the object (in JSON):

{
    "admin": true,
    "email": "fred@example.com",
    "id": 101,
    "user": "fred"
}

Related commands

Get more help

Couldn't find what you were looking for?

© RethinkDB contributors
Licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License.
https://rethinkdb.com/api/java/hashmap/

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部