urban-health-labs/CombineFirebase

how to use getDocuments?

Pasta opened this issue ยท 1 comments

Pasta commented

Hi,

super useful library! I'm trying to get a list of documents.

Looks like there is a getDocuments() function, but

`
environment.service.collection("collections").whereField("userId", isEqualTo: userId)
.getDocuments()
.sink(receiveCompletion: { completion in
switch completion {
case .finished: print("๐Ÿ finished")
case .failure(let error): print("โ—๏ธ failure: (error)")
}
}) { snapshot in
doSomething(snapshot)
}.store(in: &cancelBag)

`
but sink and doSomething are never called even when get
public func getDocuments(source: FirestoreSource = .default) -> AnyPublisher<QuerySnapshot, Error>
returns a successful promise. What am I doing wrong?

Pasta commented

Actually managed to make this work =)