I have a firestore collection which is an object that contains other objects. I want to search this larger object based on an ID. The object looks like this:
{
id1: {name: 'a', somethingElse: 'a'},
id2: {name: 'b', somethingElse: 'b'},
id3: {name: 'c', somethingElse: 'c'},
}
Since it isn't an array, and I am unable to use .find(). How can I search the object using the id, and return the name?
This is what I'm working with so far:
function findUser(id, users){
users.find(function(id{
return id.name
})
}
which, of course, doesn't work