With UPDATE i refer to this method (that i wrote to act like an update):
- (BOOL)saveExeciseTemplate:(ExerciseTemplate *) exerciseTemplate{
NSError *error;
// create an object that contains data for the new document
NSDictionary *myDictionary = [[exerciseTemplate asDictionary] copy];
// Create an empty document
CBLDocument *doc = [[self getDatabase] documentWithID:exerciseTemplate.
name];
// Save the ID of the new document
NSString *docID = [[myDictionary objectForKey:@"template_id"] copy];
// Write the document to the database
if(myDictionary && doc){
//DDLogInfo(@"Saving ID = %@...", docID);
CBLRevision *newRevision = [doc putProperties: myDictionary error:
&error];
if (newRevision) {
//DDLogInfo(@"Document created and written to database, ID =
%@", docID);
//return true;
}
if (error) {
//DDLogInfo(@"Document NOT created, error = %@",
error.localizedDescription);
//if this exerciseTemplate is already in DB, then update it
if (error.code == 409) {
[doc deleteDocument:&error];
doc = [[self getDatabase] documentWithID:docID];
CBLSavedRevision *newRev = [doc putProperties:myDictionary
error:&error];
if (!newRev) {
//DDLogInfo(@"Cannot update document. Error message:
%@", error.localizedDescription);
} else {
//DDLogInfo(@"Document updated and written to database,
ID = %@", docID);
return true;
}
}
}
}
return false;
}
Il giorno giovedì 16 luglio 2015 17:59:33 UTC+2, Jens Alfke ha scritto:
>
>
> On Jul 16, 2015, at 12:59 AM, Daniel Sonny Agliardi <[email protected]
> <javascript:>> wrote:
>
> This "issue" happens when i do about 30 UPDATE queries in a for.
>
>
> Can you show what your code looks like? I’m not sure exactly what you’re
> calling because there’s nothing in Couchbase Lite called literally “UPDATE”.
>
> Also, are you saying it takes 12 seconds (the time shown in the profile)
> to do 30 document updates? That’s way off from our benchmarks; you should
> be able to update something like 1,000 docs a second (depending on the
> device and the size of the docs of course.)
>
> —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/af0dabbe-89cd-420d-b71a-502dc28ef19e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.