document::element max{doc_view["max"]}; REQUIRE(max); REQUIRE(max.type() == type::k_int32); REQUIRE(max.get_int32() == 100); // flags should be set to 0x10 document::element padding{doc_view["flags"]}; REQUIRE(padding); REQUIRE(padding.type() == type::k_int32); REQUIRE(padding.get_int32() == 0x10); // storageEngine should not be set document::element engine{doc_view["storageEngine"]}; REQUIRE(!engine); // validator and validationLevel should be set, but not validationAction document::element validator{doc_view["validator"]}; REQUIRE(validator); REQUIRE(validator.type() == type::k_document); REQUIRE(validator.get_document().value == rule); document::element validationLevel{doc_view["validationLevel"]}; REQUIRE(validationLevel); REQUIRE(validationLevel.type() == type::k_utf8); REQUIRE(validationLevel.get_utf8().value.to_string() == "strict"); document::element validationAction{doc_view["validationAction"]}; REQUIRE(!validationAction); } }
cm.no_padding(false); auto doc = cm.to_document(); document::view doc_view{doc.view()}; // noPadding should be set to false document::element padding{doc_view["noPadding"]}; REQUIRE(padding); REQUIRE(padding.type() == type::k_bool); REQUIRE(padding.get_bool() == false); // validator and validationLevel should be set, but not validationAction document::element validator{doc_view["validator"]}; REQUIRE(validator); REQUIRE(validator.type() == type::k_document); REQUIRE(validator.get_document().value == rule); document::element validationLevel{doc_view["validationLevel"]}; REQUIRE(validationLevel); REQUIRE(validationLevel.type() == type::k_utf8); REQUIRE(validationLevel.get_utf8().value.to_string() == "strict"); document::element validationAction{doc_view["validationAction"]}; REQUIRE(!validationAction); // index flag should be set document::element ttl_index{doc_view["index"]}; REQUIRE(ttl_index); REQUIRE(ttl_index.type() == type::k_document); document::element ttl_key{doc_view["index"]["keyPattern"]};