Error while storing large data in couchbase saying "Too large value" with status code = 3

I am facing a big problem now when trying store large data in couchbase using the following code :

var status = client.ExecuteStore(StoreMode.Add, “Tests”, result);

I am using .net 4.0 (C#), and the status code returned with value 1 so how can i fix this issue and store large data ?

Please i need urgent help.

Thanks in advance.

Ahmy -

How big is the document you are trying to store? There is a 20MB max size for documents in Couchbase server. If you need to store bigger documents, then you’ll need to split the documents into multiple smaller documents and then store references to the keys in a “meta” document or equivalent.

  • Jeff

I am trying to store list of objects may be it exceeds 20 MB but how can i expand this size to be 40 MB for-example ?
I need to know if each key to be stored can’t exceed 20 MB ? but the total keys can exceed till the max allowed memory ?
Thanks.

Hi Ahmy,

As Jeff mentioned, each individual document or key/value pair cannot exceed 20 MB.

Our suggestion would be to split each document in smaller chunks. You’ll probably get the best results with documents of less than 5MB each.

Let’s say you’re creating an instant messaging platform and a particular conversation became extraordinarily long and took up several megabytes. You could use a combination of an atomic counter and key naming to track the chunks.

So, each of your chunks would have a key name something like this:

im_text::X

Where X is the number of the chunk: e.g. im_text::1, im_text::2, im_text::3 and so on.

You’d use Couchbase’s atomic counter data type to keep track of how many chunks you have in each conversation and also to provide you with the number of the next chunk. So, you might have something like:

im_text::counter

Each time you want to add a new chunk, you’d send an increment to im_text::counter and it’d return the number to use. To find out how many chunks you have in the conversation, simply GET im_text::counter.

I hope that helps.

Matthew.

Hi Matthew,
could you clarify if the values proposed here for maximum size of document also applies to Couchbase Lite for iOS?

Where can I find this information inside the documentation?

best regards,
Tiago DUarte

Hey Tiago,

For Couchbase Lite the max document size is 20MB and then you can have an attachment that has its own size limit of up to 20MB.

You can see the limit reference in this blog post: http://blog.couchbase.com/couchbase-lite-future-mobile-faq

Cheers!

Matthew.