code | type | title | description |
---|---|---|---|
true |
page |
validate |
Validate a document |
Validates data against existing validation rules.
Documents are always valid if no validation rules are defined on the provided index and collection.
This request does not store the document.
bool validate(
const std::string& index,
const std::string& collection,
const std::string& document);
bool validate(
const std::string& index,
const std::string& collection,
const std::string& document,
const kuzzleio::query_options& options);
Argument | Type | Description |
---|---|---|
index |
const std::string& |
Index name |
collection |
const std::string& |
Collection name |
document |
const std::string& |
JSON string representing the document |
options |
kuzzleio::query_options* |
Query options |
Additional query options
Option | Type (default) |
Description |
---|---|---|
queuable |
bool ( true ) |
If true, queues the request during downtime, until connected to Kuzzle again |
A boolean set to true if the document is valid and false otherwise.
Throws a kuzzleio::KuzzleException
if there is an error. See how to handle errors.
<<< ./snippets/validate.cpp