title: Return a document with query in firestore
body: <p>I want to return a document from a function using Firestore. Here is my query:</p>
  
  <pre><code>public class func getProductsInShoppingList(name:String = "Default") -&gt; DocumentSnapshot?{
      let db = Firestore.firestore()
  
      let defaults = UserDefaults.standard
      let userId: String! = defaults.string(forKey: "UserUUID")
  
      var doc:DocumentSnapshot?
      db.collection("shoppingLists")
          .whereField("users." + userId, isEqualTo: true)
          .whereField("name", isEqualTo: name)
          .limit(to: 1)
          .getDocuments() { (querySnapshot, err) in
              if let err = err {
                  print("Error getting documents: \(err)")
              } else {
                  for document in querySnapshot!.documents {
                      print("\(document.documentID) =&gt; \(document.data())")
                      doc =  document
                      break
                  }
              }
      }
      return doc
  }
  </code></pre>
  
  <p>This is obviously an async operation. What is the proper way to return and use the document. Notification? Call back? Thanks</p>