| 123456789101112131415161718192021222324252627 |
- #pragma once
- #include <nlohmann/json.hpp>
- #include <string>
- #include <vector>
- namespace smartbotic::database {
- /**
- * Apply view projection (include/exclude) to a document.
- *
- * Semantics:
- * - include non-empty: only those paths are kept (exclude ignored)
- * - include empty, exclude non-empty: all fields except excluded paths
- * - both empty: document returned unchanged
- *
- * Paths use dot notation: "user.profile.name". Stops at arrays.
- * Missing intermediate paths are silently skipped.
- *
- * Metadata fields (_id, _version, _created_at, _updated_at, _created_by, _updated_by)
- * are always preserved regardless of include/exclude.
- */
- nlohmann::json applyProjection(const nlohmann::json& document,
- const std::vector<std::string>& include,
- const std::vector<std::string>& exclude);
- } // namespace smartbotic::database
|