* This expression implements a MongoDB dot-separated path expansion (it returns all subdocuments * patching the given path, expanding arrays as necessary). */
| 53 | * patching the given path, expanding arrays as necessary). |
| 54 | */ |
| 55 | struct ExtPathExpression : IExpression, ReferenceCounted<ExtPathExpression>, FastAllocated<ExtPathExpression> { |
| 56 | |
| 57 | Standalone<StringRef> path; |
| 58 | std::string strPath; |
| 59 | bool expandLastArray; |
| 60 | bool imputeNulls; |
| 61 | |
| 62 | void addref() { ReferenceCounted<ExtPathExpression>::addref(); } |
| 63 | void delref() { ReferenceCounted<ExtPathExpression>::delref(); } |
| 64 | |
| 65 | std::string toString() const override { return "ExtPath(" + strPath + ")"; } |
| 66 | |
| 67 | ExtPathExpression(std::string const& strPath, bool const& expandLastArray, bool const& imputeNulls) |
| 68 | : strPath(strPath), expandLastArray(expandLastArray), imputeNulls(imputeNulls) { |
| 69 | path = encodeMaybeDotted(strPath); |
| 70 | } |
| 71 | |
| 72 | GenFutureStream<Reference<IReadContext>> evaluate(Reference<IReadContext> const& document) override; |
| 73 | |
| 74 | std::string get_index_key() const override { |
| 75 | return expandLastArray ? strPath : std::string(); |
| 76 | } // FIXME: a.$n?.b.$n |
| 77 | }; |
| 78 | |
| 79 | #endif |
nothing calls this directly
no outgoing calls
no test coverage detected