@classmethod<EOL><INDENT>def _projection_to_paths(cls, root_key, projection):<DEDENT>
<EOL>if '<STR_LIT>' in projection:<EOL><INDENT>return True<EOL><DEDENT>inclusive = True<EOL>sub_projection = {}<EOL>for key, value in projection.items():<EOL><INDENT>if key in ['<STR_LIT>', '<STR_LIT>']:<EOL><INDENT>continue<EOL><DEDENT>if key.startswith('<STR_LIT:$>'):<EOL><INDENT>sub_projection[root_key] = {key: value}<EOL>inclusive = False<EOL>continue<EOL><DEDENT>sub_key = root_key + '<STR_LIT:.>' + key<EOL>if isinstance(value, dict):<EOL><INDENT>sub_value = cls._projection_to_paths(sub_key, value)<EOL>if isinstance(sub_value, dict):<EOL><INDENT>sub_projection.update(sub_value)<EOL><DEDENT>else:<EOL><INDENT>sub_projection[sub_key] = True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>sub_projection[sub_key] = True<EOL>inclusive = False<EOL><DEDENT><DEDENT>if inclusive:<EOL><INDENT>return True<EOL><DEDENT>return sub_projection<EOL>
Expand a $sub/$sub. projection to a single projection of True (if
inclusive) or a map of full paths (e.g `employee.company.tel`).