python-cloudant query error -


i using python-cloudant library, trying query:

import cloudant  my_database = client['database']  query = cloudant.query.query(my_database,selector={'selector': {'$gt': 0}},fields=['doi']) doc in query(limit=100, skip=100)['docs']:     print doc 

this gives me error: httperror: 400 client error: bad request url: https://myurl.com/mydatabase/_find

with error when try loading page in browser: {"error":"method_not_allowed","reason":"only post allowed"}

what missing here?

unless have index on field named selector query won't work.

so assuming meant use primary index on _id field if change selector={'selector': {'$gt': 0}} selector={'_id': {'$gt': 0}} query should work.

as in:

import cloudant  client = cloudant.cloudant(user, pwd, account=account) client.connect()  my_database = client['database']  query = cloudant.query.query(my_database,selector={'_id': {'$gt': 0}},fields=['doi']) doc in query(limit=100, skip=100)['docs']:     print doc 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -