Updated scan/query api for more flexible conditions