Batch import wasn't updated
This commit is contained in:
@@ -30,7 +30,7 @@ class Firestore(IDocumentStore):
|
||||
|
||||
return None
|
||||
|
||||
async def get_all(self, collection: str) -> List[Dict]:
|
||||
async def find(self, collection: str, query: Optional[Dict] = None) -> List[Dict]:
|
||||
collection_ref: AsyncCollectionReference = self._client.collection(collection)
|
||||
docs = []
|
||||
async for doc in collection_ref.stream():
|
||||
@@ -45,3 +45,6 @@ class Firestore(IDocumentStore):
|
||||
if doc.exists:
|
||||
return doc.to_dict()
|
||||
return None
|
||||
|
||||
async def update(self, collection: str, filter_query: Dict, update: Dict) -> Optional[str]:
|
||||
raise NotImplemented()
|
||||
|
||||
@@ -29,9 +29,13 @@ class MongoDB(IDocumentStore):
|
||||
|
||||
return None
|
||||
|
||||
async def get_all(self, collection: str) -> List[Dict]:
|
||||
cursor = self._mongo_db[collection].find()
|
||||
async def find(self, collection: str, query: Optional[Dict] = None) -> List[Dict]:
|
||||
query = query if query else {}
|
||||
cursor = self._mongo_db[collection].find(query)
|
||||
return [document async for document in cursor]
|
||||
|
||||
async def update(self, collection: str, filter_query: Dict, update: Dict) -> Optional[str]:
|
||||
return (await self._mongo_db[collection].update_one(filter_query, update)).upserted_id
|
||||
|
||||
async def get_doc_by_id(self, collection: str, doc_id: str) -> Optional[Dict]:
|
||||
return await self._mongo_db[collection].find_one({"id": doc_id})
|
||||
|
||||
Reference in New Issue
Block a user