C# Get list with a startkey

Hello

I try to get a list of data with a startkey, i create items with a nested key.
For Examlpe:

key: email::list1::item1
key: email::list1::item2

Now i want select all items of “email::list1” if it possible without any view?

My current solution is
client.GetView(“all”, “email”).StartKey(“email::list1”);

http://de.slideshare.net/Couchbase/couchbase-103-data-modeling?related=3 (Page 24) only bad keys need views?

Thanks
Tino

There are some options but the best bet is always to know the key completely if possible.

Possible options:
Use a Document with references to all you keys if they cannot be calculated.
“email:#list1:keys” -> { “items:” [“item1”,“item2”, …] }
See: Best Practice: View-Lookup vs Key-List in Document

If you know the start of the key “key:email::list1:” you could iterate trough all the names until you run out of names assuming your items have a naming order.
“if CB.exists?(key) CB.get(key)”

Another method would be to have a Number-Value for each list containing the size of the List.
“email:#list1:counter” -> 45
With that information you can iterate from the front or from the back of the list or even directly access keys in the middle knowing they exist.

Kade

On my project i have very big lists. It possible one list have more as 1 million items. I think the way with one document with all other keys inside is not practicable. A other requirement is filtering the data. For this use case not a lot of examples are available.

If a list of a single user/email can contain millions of items you need to give a better specification as this is a special use-case. The current information do not allow a qualified answer - only guessing.

No we have multiple groups and this groups can contain 1-2 million email addresses. It is a prototype for a email marketing software.

An other way is to get the list of keys by a view to delete it after. I did it on a projet. I work fine.