Error: Unhandled Exception: PlatformException(Error performing getDocuments, INVALID_ARGUMENT)

Viewed 122

I would like to update a document field after the user performs a certain action. Here is my code:

          _title = data["postTitle"];
          _content= data["postContent"];
          Firestore.instance.collection("Social_Posts")
              .where("postTitle", isEqualTo: _title)
              .where("postContent", isEqualTo: _content).getDocuments()
              .then((event) {
              Firestore.instance
                  .collection("Social_Posts")
                  .document(event.documents[0].documentID)
                  .updateData({"views" : FieldValue.increment(1),}).then((value){});
          });

When I run this code, I get the error: Unhandled Exception: PlatformException(Error performing getDocuments, INVALID_ARGUMENT: value for postContent is too large to be used in a query, null)

This error only occurs when my document field is too large. How do I fix this issue and perform the query?

0 Answers
Related