Re: Chaincode queries with couchDB #fabric-chaincode


David Enyeart
 

The normal CouchDB query syntax is used in Fabric, please see the CouchDB query reference at https://docs.couchdb.org/en/3.1.1/api/database/find.html.


Dave Enyeart


pham.qtpham---12/19/2021 05:18:34 AM---Hi, I followed the doc (INVALID URI REMOVED

From: pham.qtpham@...
To: fabric@...
Date: 12/19/2021 05:18 AM
Subject: [EXTERNAL] [Hyperledger Fabric] Chaincode queries with couchDB #fabric-chaincode
Sent by: fabric@...





Hi, I followed the doc (https://hyperledger-fabric.readthedocs.io/en/latest/couchdb_as_state_database.html ) to create index as below: { "index": { "fields": ["ownerName", "paymentAmountDue"] ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ZjQcmQRYFpfptBannerStart 
This Message Is From an External Sender
This message came from outside your organization.
ZjQcmQRYFpfptBannerEnd
Hi,

I followed the doc (
https://hyperledger-fabric.readthedocs.io/en/latest/couchdb_as_state_database.html ) to create index as below:

{

    "index": {

        "fields": ["ownerName", "paymentAmountDue"]

    },

    "ddoc": "ownerIndexDoc",

    "name": "ownerIndex",

    "type": "json"

}


Then I use this index to query by using:

{"selector":{"ownerName":"Joe","paymentAmountDue": "0"}}
 
It works and the query returns all transactions having ownerName="Joe" and paymentAmountDue = 0.

Now I want to  query all transactions having ownerName="Joe" and paymentAmountDue <> 0. How can I achieve this?

Thx in advance.

Trung





Join fabric@lists.hyperledger.org to automatically receive all group messages.