Cant query in Hyperledger Composer

0 votes

I am trying to run this query:

query PapersFromAPoll
{
    description: "retrieve all the papers from a poll"
    statement:
         SELECT org.acme.democracity.Paper 
          WHERE(poll.pollId == _$id)
}

When I execute this query, i dont get any rows, here is the fragment where I make this query:

return query('PapersFromAPoll',{id : count.poll.pollId})

Paper and Poll in model.cto file:

asset Paper identified by paperId {
    o String paperId
    o String[] fields
    --> Poll poll  //Paper related with a poll
}

asset Poll identified by pollId {
    o String pollId
    o Ask[] asks
}
Oct 26, 2018 in Blockchain by digger
• 27,620 points
29 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

There's a mistake in your WHERE statement. Your query should be:

query PapersFromAPoll
{
  description: "retrieve all the papers from a poll"
  statement:
    SELECT org.acme.democracity.Paper 
      WHERE(poll == _$pollId)
}
answered Oct 26, 2018 by Omkar
• 65,810 points

Related Questions In Blockchain

+1 vote
1 answer

What happened on deploy, invoke and query in Hyperledger chaincode?

1. Deploy: During Deploy the chaincode is written onto ...READ MORE

answered Apr 26, 2018 in Blockchain by Christine
• 15,790 points
223 views
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
+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

Hyperledger composer: How to include relationship in custom query?

You are trying to use filter={"include":"resolve"} in Composer Query. ...READ MORE

answered Nov 16, 2018 in Blockchain by Omkar
• 65,810 points
233 views
+16 votes
4 answers

© 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.