0

I am new to cloud-ant, In my current assignment i want to search all distinct records based on fields x:

I have documents which have domain as attribute. I want all unique domains which are present in my db.Below is the example,

documentNo1-{"domain":"gmail.com"}
documentNo2-{"domain":"ymail.com"}
documentNo3-{"domain":"gmail.com"}

expected result is API should return only unique domain name, like below

[gmail.com,ymail.com]

I am not getting operators in cloud-ant which can achieve this, only solution i have is to retrieve it and create our own unique domain list.

Looking for any good approach/solution for above scenario.

1 Answers1

1

You can use Cloudant Search to create a faceted index.

See https://console.bluemix.net/docs/services/Cloudant/api/search.html#faceting

This would allow you to essentially group documents by domain, creating the unique list you need.

There is a good video tutorial showing this technique:

https://www.youtube.com/watch?v=9er3XI150VM

xpqz
  • 3,617
  • 10
  • 16