SDK
SDK C++ v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

This SDK has been deprecated because of stability issues. It is not advised to use it in a production environment.

mGet #

Gets multiple documents.

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

Signature #

std::string mGet(
    const std::string& index,
    const std::string& collection,
    const std::vector<std::string>& ids);

std::string mGet(
    const std::string& index,
    const std::string& collection,
    const std::vector<std::string>& ids,
    const kuzzleio::query_options& options);

Arguments #

ArgumentTypeDescription
index
const std::string&
Index name
collection
const std::string&
Collection name
ids
std::vector<std::string>
Document IDs
options
kuzzleio::query_options*
Query options

options #

Additional query options

OptionType
(default)
Description
queuable
bool

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

Return #

A JSON string representing an array of objects containing the following properties:

PropertyTypeDescription
_id_
string
Document ID
_source_
object
Document content

Exceptions #

Throws a kuzzleio::KuzzleException if there is an error. See how to handle errors.

Usage #

std::vector<std::string> ids;
ids.push_back("some-id");
ids.push_back("some-other-id");
try {
  kuzzle->document->create("nyc-open-data", "yellow-taxi", "some-id", R"({"capacity": 4})");
  kuzzle->document->create("nyc-open-data", "yellow-taxi", "some-other-id", R"({"capacity": 7})");
  std::string response = kuzzle->document->mGet(
    "nyc-open-data",
    "yellow-taxi",
    ids);
  std::cout << response << std::endl;
  /*
    [
      {
        "_index": "nyc-open-data",
        "_type": "yellow-taxi",
        "_id": "some-id",
        "_version": 1,
        "found": true,
        "_source": {
          "capacity": 4,
          "_kuzzle_info": {
            "author": "-1",
            "createdAt": 1545411356404,
            "updatedAt": null,
            "updater": null,
            "active": true,
            "deletedAt": null
          }
        }
      },
      {
        "_index": "nyc-open-data",
        "_type": "yellow-taxi",
        "_id": "some-other-id",
        "_version": 1,
        "found": true,
        "_source": {
          "capacity": 7,
          "_kuzzle_info": {
            "author": "-1",
            "createdAt": 1545411356424,
            "updatedAt": null,
            "updater": null,
            "active": true,
            "deletedAt": null
          }
        }
      }
    ]
  */
  std::cout << "Successfully retrieved 2 documents" << std::endl;
} catch (kuzzleio::KuzzleException& e) {
  std::cerr << e.what() << std::endl;
}