Hello. I want to know, whether Couchbase allows him to do what in Redis called “Sorted set” For instance, I have millions of sets each of them contains tens of documents. In Redis it is absolutely no problem to achieve, just make as many sets as I want.
But in Couchbase I did not found such feature, only Secondary Index. So I can only make one bucket and put all documents there, separated by index. For instance, in Redis:

Will this work as Redis sets? Will it be fast on tens of millions documents with many inserts? I need ultra fast inserts and selects with same predicted speed regardless of the number of documents in buckets.

P.s. The JSON data model is quite flexible, and the best way to implement types like “set” or “list” depends a great deal on your specific requirements. If you implement something as an array,

{ "contents": [ "item1", "item2", "item3"] }

you get ordering for free, but searching for an item is O(size of array). But JSON objects behave a lot like Hashes or associative maps, but if order is important you would need to add that explicitly:

{ "contents": { "item1": 1, "item2": 2, "item3": 3 } }

In this approach you can find out if an item is present or absent quickly (e.g. ‘where contents.item1 is not missing’, but ordering requires a sort.

So to decide how to model the data, you need to figure out which operations you need to perform on the data.