| 286 | } |
| 287 | |
| 288 | std::string Projection::debugString(bool first) { |
| 289 | std::stringstream s; |
| 290 | if (first && !included) { |
| 291 | s << "."; |
| 292 | } |
| 293 | |
| 294 | s << "{"; |
| 295 | bool addComma = false; |
| 296 | for (const auto& itr : fields) { |
| 297 | if (addComma) |
| 298 | s << ", "; |
| 299 | else |
| 300 | addComma = true; |
| 301 | |
| 302 | if (!itr.second->included) { |
| 303 | s << "."; |
| 304 | } |
| 305 | |
| 306 | s << itr.first; |
| 307 | |
| 308 | if (!itr.second->fields.empty()) { |
| 309 | s << ": " << itr.second->debugString(false); |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | s << "}"; |
| 314 | return s.str(); |
| 315 | } |
| 316 | |
| 317 | // Called for each field read from a document in lexicographic order. Returns INCLUDE_ALL if the entire field should be |
| 318 | // included, INCLUDE_PARTIAL if the field should be partially included (e.g. for an array, the array will be included |