*After making a lot of research on this:*
I found that you should not have any property in your map which has a key
starting with *underscore character* '_' because it is reserved for
CouchbaseLite.
CouchbaseLite currently does not give you a proper exception message for
this so you will be stuck. The only thing you need to take care is to not
to include any such key in your map.
Like if you have _id and _rev fields in your class(obj) then you need to
remove them
map.remove("_id");
map.remove("_rev");
before calling:
try {
document.putProperties(map);
} catch (CouchbaseLiteException e) {
e.printStackTrace();
}
On Thursday, March 27, 2014 11:59:29 AM UTC+5:30, Pankaj Jakhar wrote:
>
> I am trying to put properties Map in a CBLite document but getting
> exception. Please answer me what should I do. For formatting reasons I have
> put this question on StackOverflow.
>
>
> http://stackoverflow.com/questions/22679850/com-couchbase-lite-couchbaseliteexception-when-document-putpropertiesmap-is-ca
>
>
> Map<String, Object> map = new HashMap<String, Object>();
> map = (Map<String, Object>) gson.fromJson(json, map.getClass());
> //map.put("_id", UUID.randomUUID().toString());
>
> Document document = mDatabaseLocal.createDocument();
> try {
> document.putProperties(map);
> } catch (CouchbaseLiteException e) {
> e.printStackTrace();
> }
>
> Exception:
>
> com.couchbase.lite.CouchbaseLiteException
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/mobile-couchbase/8011a866-b50b-4b48-862b-c0b7bbb94598%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.