Hyperledger composer: How to include relationship in custom query?

0 votes

I want to include relationships of particular asset in custom queries written in queries.qryfile:

Models

User
    o String id
    o String name
    o Integer age

Account
    id
    account_type
    --> User owner

queries.qry

query selectAccountByType {
  description: "Select all accounts based on type"
  statement:
    SELECT com.rohitkhatri.bank.Account WHERE (account_type==_$account_type)
}

Now, when I fetch the accounts, it should include the user relationship.

This is what I have tried, composer-rest-server:

/queries/selectAccountByType?account_type=saving&filter={"include":"resolve"}

It returns the following error:

{'status_code': 500, 'message': 'Invalid or extraneous parameter filter has been specified'}

Can someone help me out with this?

Nov 16, 2018 in Blockchain by digger
• 27,620 points
234 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You are trying to use

filter={"include":"resolve"}

in Composer Query. But, it is a not part of the Composer Query Language syntax.

The Filter should be performed on the asset class in the REST APIs

answered Nov 16, 2018 by Omkar
• 65,810 points

Related Questions In Blockchain

0 votes
1 answer

How to solve EACCES:permission denied error in Hyperledger Composer?

It seems like there is no required ...READ MORE

answered Jul 11, 2018 in Blockchain by digger
• 27,620 points
214 views
0 votes
1 answer

How to solve "error trying install composer runtime" in Hyperledger composer?

I think the docker-compose tool is not ...READ MORE

answered Jul 17, 2018 in Blockchain by slayer
• 29,040 points
51 views
0 votes
1 answer
+1 vote
1 answer

I am unable to change port of composer-rest-server. Please help!

Use full format for running a business ...READ MORE

answered Mar 27, 2018 in Blockchain by Christine
• 15,790 points
205 views
+1 vote
1 answer
0 votes
1 answer

How to get TimeStamps in Hyperledger Composer?

Here's an example that works with basic-sample-network network: asset SampleAsset ...READ MORE

answered Oct 26, 2018 in Blockchain by Omkar
• 65,810 points
123 views
0 votes
1 answer

Hyperledger composer: How to allow create in transaction? Access Control

This is how you can do it: /** @returns ...READ MORE

answered Nov 8, 2018 in Blockchain by Omkar
• 65,810 points
87 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.