【发布时间】:2016-10-25 13:23:44
【问题描述】:
我用这个架构定义了一个资源
# 'people' schema definition
'schema'= {
'firstname': {
'type': 'string',
'minlength': 1,
'maxlength': 10,
},
'lastname': {
'type': 'string',
'minlength': 1,
'maxlength': 15,
'required': True,
'unique': True,
},
# 'role' is a list, and can only contain values from 'allowed'.
'role': {
'type': 'list',
'allowed': ["author", "contributor", "copy"],
},
# An embedded list of 'strongly-typed' dictionary.
'locations': {
'type': 'list',
'schema' {
'type': 'dict',
'schema': {
'address': {'type': 'string'},
'city': {'type': 'string'}
},
},
},
'born': {
'type': 'datetime',
},
}
是否可以通过引用相同的人员数据源将位置定义为子资源并对其进行搜索?
例如人//位置/
回复:地点列表
我需要将位置存储在人员文档中的原因是为了利用 mongo 中的文档原子性。
我可能需要在一个事务中更新一个人的多个位置。因此,我想确保一个人的所有需要的位置(或没有)都已更新。不可能有中间状态。
【问题讨论】:
标签: eve