Nika,

We’re going to be adding this use case as part of our upcoming “convenience” 
API.

In C#, you’ll be able to do something like:

        var myObj = new Employee 
                { 
                        Id = "zg", 
                        FirstName = "Zack", 
                        LastName = "Gramana", 
                        DepartmentId = 1
                };

        db.Save(myObj);

and

var myObj = db.Get<Employee>("zg");

It wouldn’t be hard to add something like:

         db.Save("zg", "{'firstName':'Zack',…}"); 

Is the use case you have in mind a HttpClient fetch-and-store from a REST 
endpoint?

> On Mar 3, 2015, at 10:29 AM, [email protected] 
> <mailto:[email protected]> wrote:
> 
> 
> (Using xamarin lite, C# but general couchbase lite question)
> 
> Couchbase document.properties is IDictionary<String, Object> properties. 
> Objects in business logic layer have different representations of course, and 
> include nested members, also arrays etc (not trivial 1 level key-value 
> types). 
> 
> In order to update a document, I can serialize my objects to JObject  or just 
> json string but I don't want to handcraft each type to convert it to 
> dictionaries. I dont see anything in API besides IDictionary<String, Object> 
> properties.
> 
> 
> Is there a way to update/create document by giving it json (and not 
> IDictionary)?
> 
> Note:
> The opposite direction, ie retrieving document properties into json, is ok 
> for me because JObject.FromObject(document.properties) is correctly handling 
> Couchbase IDictionary<string, object> from coucbhase document and so i can 
> correctly deserialize results into my types.
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/mobile-couchbase/8e597bc5-fbd6-4b92-bd3d-112ee8a97473%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/mobile-couchbase/8e597bc5-fbd6-4b92-bd3d-112ee8a97473%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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/5114ACF7-70A9-454F-898C-0D4041A7CBD7%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to