Design recommendation to append values on the same key


I want to know if there ability to add into couchbase multiple docs having the same key. so a key could act as key for list of values.

So when I want to retrieve a key’s value ill be able to get all values as list/array and somehow order them by insert time, etc…

I know that in Redis you can append to the same key multiple values

Example of document:

The key is the username: JohnD and the value is document with details and last login time like this:

{“firstName”:“John”, “lastName”:“Doe”, “status”:“success”, “lastloginDate”:“2013-04-14:22:30:14”}

The user is going to login couple of times and I want to record each time he logs in with some extra details.

now in some point I want to retrieve that list sorted by time and get specific item from it.



No, in Couchbase keys are unique per document.

It sounds like you probably want to define a view to index documents by user and lastLoginDate (i.e. the key would be [username, lastloginDate]). Then you can query for a specific user and get all their documents sorted by lastLoginDate.


Hi Jens,
thanks for your reply.
How would you construct that key? for example: jossefH_2014_22_12_22_30_00 ? (date format: YYYY_mm_dd_hh_min_sec) or you meant something else?