1

I get an error message:

FIREBASE WARNING: Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ".indexOn": "author" at /questions to your security rules for better performance.

my firebase rules :

"questions": {
      ".read": true,
      ".write": true,
        ".indexOn": ["category,author"]
    },

My firebase data :

 "questions" : {
    "-Ls1LfayKF9TUg20ByPE" : {
      "question" : "1",
      "timestamp" : 1571997530706,
      "author" : "9jNkvzr0chgPi0SC6rXMlVWdOF12"
    },
    "-Ls1Lj_OG4lo11r3WQzF" : {
      "question" : "2",
      "timestamp" : 1571997546988,
      "author" : "9jNkvzr0chgPi0SC6rXMlVWdOF12"
    },

My code :

const ref = FirebaseRef.child('questions')
ref.orderByChild('author').equalTo(UID).limitToLast(this.state.limit)
      .on("child_added", snapshot => {
       console.log("FireB ",snapshot)
    var items = [];
    snapshot.forEach((child) => {
      items.push({
        key: child.key,
        ...child.val()
      });
    });

1 Answer 1

1

The .indexOn can be an array of string values. You now actually have only one string value in there.

So replace:

".indexOn": ["category,author"]

With:

".indexOn": ["category", "author"]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.