I am using realtime datebase. I need to make a request to the server by key value. I can create a query if the value entered by the user matches the value of the key, for this I use equalTo().
const db = getDatabase(appFirebase)
const dbRef = ref(db, 'products')
const getData = async () => {
const data = await get(query(dbRef, orderByChild('name'), equalTo('118370')))
console.log(data.val())
return data.val()
}
getData()
but how do I return an object that has a name property with a value of "45180 Bearing 118370, 142088, CA0118370, 141591, 6195530M91, 399037"?
name: '45180 Bearing 118370, 142088, CA0118370, 141591, 6195530M91, 399037'
How to check if a substring exists in a string?