Monday 15 August 2011

What's the functional difference to using 'replace' vs 'update' conflict resolution in RethinkDB -


When an attempt is made to insert a document (based on the primary key), there are few ways to resolve the dispute in the re-operation process.

Possible values ​​are "error", "replacement" or "update". "Error": Do not insert new documents and record conflict as an error. It is the default "Replace": replace the old document with a whole new one in its entirety. "Update": Update field of old document with field from new document

Although I am clear on the technical difference between 'replacement' and 'update' functional difference between the two (if any)

For example, It seemed as if one of these has not taken the result of an incident on the change, when the doctor inserted is already similar to the existing doctor, but it does not seem that litigation.

So, what is the functional difference between the two options?

(and may delete the field), Update will only update the field, and will never delete the field.

If your document is {id: 1, foo: "hello", bar: "world"}

  r.table ('data'). (1) Get .update ({foo: "bonjour"}) / / - & gt; (Id: 1, foo: "bonjour", bar: "world"} r.table ('data'). Get (1) .replace ({id: 1, foo: "bonjour"}) // - & gt; ; {Id: 1, foo: "bonjour"}  

No comments:

Post a Comment