firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.04k stars 951 forks source link

dataconnect query with String_Pattern doesnt work. uknown key pattern #7943

Open artanisdesign opened 2 weeks ago

artanisdesign commented 2 weeks ago

Environment info

firebase-tools: 13.25.0

Platform: mac

Test case

query getItemsByName($regex: String) { matchRegex: items(where: {title: {pattern: {regex: $regex}}}){ title } }

Steps to reproduce

i just run this query in the console

Expected behavior

list items with title that matches regex

Actual behavior

"message": "(where.title: String_Filter): unknown key pattern",

joehan commented 2 weeks ago

Hey @artanisdesign - sorry for the inconvenience here. I just checked, and it looks like the documentation for this feature went out before it was actually implemented. It should be coming soon, but for now I'm going to remove it from the docs (https://firebase.google.com/docs/reference/data-connect/gql/input_object#String_Filter)

If there is somewhere else that you noticed this documented, please let me know!

In the meantime, I'd recommend using contains instead to implement similar operations - ie:

query getItemsByName($name: String) { matchRegex: items(where: {title: {contains: $name}}){ title } }

artanisdesign commented 2 weeks ago

hi @joehan thanks for the reply.

yea.. i've been using contains.. problem is with that one its case sensitive.. so basically i had to create a searchstring property.. which is lowercase.. to make contains work. not ideal.. but i guess will have to do until pattern becomes available.