Hey!
So i’m working on a ‘typeahead’ function whilst will check my Database to search users as they type. However when I try to implement the ‘startAt’ query property I only return undefined.
I have tried testing with hardcoding my ‘startAt:’ key however this still returns the same?
my function is as such
function searchUsers(searchString) {
db.getValue("public/nameList/", {
orderByChild: true,
startAt: searchString, //if i comment this i return the branch in full.
limitToFirst: 10,
}, function(success, key, value) {
if(success) {
searchArr = []
searchArr = value
console.debug("Read user value for key", key, "from DB:", value)
}
})
}
A sample of my JSON is
nameList: {
"EddieLaw245" : 530343772383,
"EddieLawrence91" : 530343772385,
"EdwardL91" : 530343772386,
"EdwardLaw" : 530343772384,
"Edwardlawrence91" : 530343772380,
"JoBrownLondon" : 530343772381,
"KatiePrescottHair" : 543592635596,
"Tracey-Sweeting" : 530343772382
}
What i want, with the above example – is as i type Ed it will immediately filter out the bottom 3 entries, if i then type EDW it will filter out the EDD entries and so on.
Thanks