I have a database which is shown in below
I want to show only the full_names
in order. I want that output:
Alan Turing
Alan Turing
Alan Turing
Alan Turing
Alan Turing
I tried with this code below but it shows the user names.
import firebase_admin
from firebase_admin import credentials
from firebase_admin import db
# Fetch the service account key JSON file contents
cred = credentials.Certificate('BLABLA.json')
# Initialize the app with a service account, granting admin privileges
firebase_admin.initialize_app(cred, {
'databaseURL': 'https://BLABLA.firebaseio.com/'
})
ref = db.reference('users')
snapshot = ref.order_by_child('full_name').get()
for key in snapshot:
print(key)
The output is:
alanisawesom
alanisawesome
alanisawesomee
alanisawesomeee
alanisawesomeeee
Where is my fault? Can you fix it?
EDIT: My Rules in Firebase is:
{
"rules": {
"users": {
".indexOn": ["date_of_birth", "full_name"]
},
".read": "true",
".write": "true"
}
}