I want to .indexOn userId which is not static.
My realtime database structure looks like this:
posts: {
  content: "Lorem Ipsum"
  likes: 26,
  comments: {
     userId1: true,
     userId2: true
  }
}
I want to get all the posts where current user not commented yet. My Query looks like this.
val postsDatabaseRef = FirebaseDatabase.getInstance().reference.child("posts")
            .orderByChild("comments/${currrentUserId}")
            .equalTo(null)
I'm getting this warning:
Index not defined, add ".indexOn": "comments/aMrYUjIZiDNfSdqXnXYzJPdIEtq2", for path "/posts", to the rules
This is not working out,index warning is not gone.
    "posts" : {
    "$postId": {
      "comments": {
          ".indexOn" : ".value"
      }
    }
  }
 
    