How to query to include specific words in hyperled

2019-08-27 18:29发布

问题:

I want to query 'a', 'ab', 'abc'

way( where: {field: {like: a%} } ) is unable.

'like' operator is not supported by hyperledger composer filter.

How to query to include specific words in hyperledger composer query?

回答1:

Composer Query Language presently doesn't support 'SQL like' LIKE format such as '%' or regex regexes via CQL, and reliant on the underlying CouchDB Mango QL. Feel free to raise an issue on this at https://github.com/hyperledger/composer/issues/ if you wish.

You would have to do 'OR' matches in your WHERE clause presently - or use CONTAINS in an array field.

See examples of queries used in the Query language here -> https://hyperledger.github.io/composer/latest/tutorials/queries and here -> https://github.com/hyperledger/composer-knowledge-wiki/blob/latest/knowledge.md#information_source--queries-and-query-support--examples (scroll down to item 8 onwards)