Creating doc with [database documentWIthId::”....”]. All good. But if I
keep the _rev in the dictionary when I putProperties, it fails. Take the
_rev out, and it succeeds but sets the _rev to 1-xxxxxx. Is there a way to
preserve the _rev property I get from the server?
Like this:
// d is the dictionary downloaded from the server ... this succeeds but
creates the wrong _rev
CBLDocument* doc = [app.database documentWithID:couchId];
NSError *error;
// if I take these two lines out, the putProperties fails
[d removeObjectForKey:@"_id"];
[d removeObjectForKey:@"_rev"];
if (![doc putProperties: d error: &error]) {
NSLog(@"Failed saving %@. Error: %@", [d objectForKey:@"type"], [error
localizedDescription]);
}
On Monday, February 10, 2014 2:28:00 PM UTC-8, Alan McKean wrote:
>
> How do I preserve the _rev that I get in the dictionary from the server? I
> need to preserve both for updating the server objects.
>
> On Monday, February 10, 2014 2:04:30 PM UTC-8, Jens Alfke wrote:
>>
>>
>> On Feb 10, 2014, at 1:45 PM, Alan McKean <[email protected]> wrote:
>>
>> It looks like I will have to create the CBLModel before I create the
>> CBLDocument so that it will pick up the overridden version of
>> idForNewDocumentInDatabase:. Yes?
>>
>>
>> If you create the document first, it's even easier. Just call [db
>> documentWithID:] to tell it what ID you want. Then create a model from that
>> document.
>>
>> —Jens
>>
>
--
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/d6941f48-eb23-4926-9def-f321113826b8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.