Skip to content

Commit 1255630

Browse files
committed
Add id on CollectionReference
1 parent 0de34b1 commit 1255630

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

mockfirestore/collection.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ def __init__(self, data: Store, path: List[str],
1414
self._path = path
1515
self.parent = parent
1616

17+
@property
18+
def id(self):
19+
"""The collection identifier.
20+
21+
Returns:
22+
str: The last component of the path.
23+
"""
24+
return self._path[-1]
25+
1726
def document(self, document_id: Optional[str] = None) -> DocumentReference:
1827
collection = get_by_path(self._data, self._path)
1928
if document_id is None:

0 commit comments

Comments
 (0)