Hierarchical data structures and subcollections are described in the documentation . A collection contains documents, and a document may contain a nested collection. The structure always alternates with collections and documents. The documentation contains this example description:
Pay attention to the alternating pattern of collections and documents. Your collections and documents should always follow this pattern. You cannot reference a collection in a collection or a document in a document.
Thus, a valid collection path will always have an odd number of segments; Valid document path, even number. Because your code is trying to request a collection, a path length of four is not allowed.
source share