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
• 26,740 points
776 views

1 answer to this question.

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
• 69,220 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
1,507 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
• 26,740 points
2,438 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,456 views
+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
1,130 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
• 69,220 points
1,108 views
+16 votes
4 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP