1

I'm trying to make a query that selects only one of the fields/attributes. The query should result in something like an array of a nameField or a numberField, or even a single variable, what I want is to separate the values so I can manipulate it in the app

I already tried using "query = cloudant.query.Query(myDatabaseDemo, fields=['nameField'])" but the result when I print query is just "fields=['nameField']".

from cloudant.result import Result, ResultByKey

...

client = Cloudant(serviceUsername, servicePassword, url=serviceURL)
myDatabaseDemo = client.create_database(databaseName)

...

result_collection = Result(myDatabaseDemo.all_docs, include_docs=True)
print ("document:\n{0}\n".format(result_collection[0]))

The actual code results in a set of values, like a json document

Nattelar
  • 13
  • 4

1 Answers1

1

Have you tried using Cloudant query? It allows you to specify fields (list) – A list of fields to be returned by the query.

bessbd
  • 570
  • 4
  • 17