【发布时间】:2017-12-07 12:32:10
【问题描述】:
我有一个包含以下对象的 mongo 集合:
[
{
"_id" : "a2d",
"entityType" : "Location",
"type" : "STRING",
},
{
"_id" : "a1_order",
"entityType" : "Order",
"type" : "STRING",
}
]
尝试将_entityType 附加到所有文档的id 中,其中它不存在于id id 的末尾(上述情况下的第一个对象)。
在 Spring 中使用 mongo,但我已经坚持第一步,即获取所有 id 中没有 entityType 的对象。
用正则表达式考虑这样的事情,但我不确定它应该是什么样子:
Query query = new Query();
query.addCriteria( Criteria.where( "id" ).regex( "here i need the entity type of the current document" ) );
【问题讨论】:
标签: java regex spring mongodb spring-data-mongodb