Database Reference
In-Depth Information
Figure 6-2. Alice and Bob edit collision detected
By using our
nonce
field, we can detect editing collisions and give the user the opportunity to
resolve them. Our update operation for a content node, then, looks something like the follow-
ing:
def
def
update_text
(
parent_id
,
slug
,
nonce
,
text
):
result
=
db
.
cms
.
nodes
.
update
(
{
'metadata.parent_id'
:
parent_id
,
'metadata.slug'
:
slug
,
'metadata.nonce'
:
nonce
},
{
'$set'
:{
'metadata.detail.text'
:
text
,