mGet

Gets multiple documents.

Throws a partial error (error code 206) if one or more document can not be retrieved.

Arguments

Copied to clipboard!
String mGet(
  String index,
  String collection,
  io.kuzzle.sdk.StringVector ids,
  io.kuzzle.sdk.QueryOptions options
)
String mGet(
  String index,
  String collection,
  io.kuzzle.sdk.StringVector ids
)

Argument Type Description
index
String
Index name
collection
String
Collection name
ids io.kuzzle.sdk.StringVector Document IDs
options
io.kuzzle.sdk.QueryOptions
Query options

options

Additional query options

Option Type
(default)
Description
queuable
boolean

(true)
If true, queues the request during downtime, until connected to Kuzzle again

Return

Returns a JSON string containing the retrieved documents.

Exceptions

Throws a io.kuzzle.sdk.KuzzleException if there is an error. See how to handle error.

Usage

Copied to clipboard!
StringVector ids = new StringVector();

ids.add("some-id");
ids.add("some-other-id");


try {
  kuzzle.getDocument().create("nyc-open-data", "yellow-taxi", "some-id", "{}");
  kuzzle.getDocument().create("nyc-open-data", "yellow-taxi", "some-other-id", "{}");

  String response = kuzzle.getDocument().mGet("nyc-open-data", "yellow-taxi", ids);

  System.out.println(response);
  System.out.println("Success");
} catch (KuzzleException e) {
  System.err.println(e.getMessage());
}