0

I'm trying to user firebase realtime database and facing now warning message I can't solved it

Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding '".indexOn": "sharingIds/4jjf24uurjkfJDGLS"' at MedicalCaeses to your security and Firebase Database rules for better performance

structure


MedicalCaeses { 
           urjkfJDGL
           {
              name: "Ali"
              sharingIds : {"4jjf24uurjkfJDGLS": true,"jsaiwn22Ad2GLS": true}
           }
}

.indexOn

"MedicalCaeses":{
        "sharingIds":{
            ".indexOn": ".value"
      }
    },

Query

await FirebaseDatabase.instance
        .reference()
        .child('MedicalCaeses')
        .orderByChild('sharingIds/4jjf24uurjkfJDGLS')
        .equalTo(true)
        .once();

result

W/PersistentConnection( 8104): pc_0 - Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding '".indexOn": "sharingIds/4jjf24uurjkfJDGLS"' at MedicalCaeses to your security and Firebase Database rules for better performance

I/flutter ( 8104): <Data Read> {xxxxx: {sharingIds: {4jjf24uurjkfJDGLS: true}, name: Ali}}
3
  • Your current data structure makes it easy to find the sharing IDs for a given case, but not the cases for a given sharing ID. To allow that, consider storing a separate top-level node where you start with each sharing ID and then store it's medical case IDs. For more on this see, stackoverflow.com/questions/40656589/… Commented Jul 27, 2021 at 20:26
  • @FrankvanPuffelen can you provider an example for this structure ? Commented Jul 28, 2021 at 10:29
  • There's an example in my answer to the question I linked. In there we have chatroomUsers and userChatrooms top-level nodes. In your case it might be MedicalCaeses [sic] that you already have and a new sharingIDs top-level node, where you store the medical case IDs for each sharing ID, similar to what we do for users and chat rooms in the link. Commented Jul 28, 2021 at 13:58

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.