Google Firestore: Query on substring of a property value (text search)

前端 未结 16 1572
抹茶落季
抹茶落季 2020-11-22 12:08

I am looking to add a simple search field, would like to use something like

collectionRef.where(\'name\', \'contains\', \'searchTerm\')

I tried

16条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-22 12:37

    We can use the back-tick to print out the value of a string. This should work:

    where('name', '==', `${searchTerm}`)
    

提交回复
热议问题