Skip to content

Commit

Permalink
feat: add support for optional arguments in DocumentReference.get
Browse files Browse the repository at this point in the history
  • Loading branch information
SHGoldfarb committed Aug 8, 2024
1 parent 0de34b1 commit c225a92
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions mockfirestore/document.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from copy import deepcopy
from functools import reduce
import operator
from typing import List, Dict, Any
from typing import List, Dict, Any, Optional, Iterable
from mockfirestore import NotFound
from mockfirestore._helpers import (
Timestamp, Document, Store, get_by_path, set_by_path, delete_by_path
Expand Down Expand Up @@ -63,7 +63,13 @@ def __init__(self, data: Store, path: List[str],
def id(self):
return self._path[-1]

def get(self) -> DocumentSnapshot:
def get(
self,
field_paths: Optional[Iterable[str]] = None,
transaction: Any = None,
retry: Any = None,
timeout: Optional[float] = None,
) -> DocumentSnapshot:
return DocumentSnapshot(self, get_by_path(self._data, self._path))

def delete(self):
Expand Down

0 comments on commit c225a92

Please sign in to comment.