嗨!我有这个 JSON 结构:
{
"author" : "some author"
"comment" : [{
"text" : "some text",
"date" : "some date",
}, {
"text" : "some text",
"date" : "some date",
}]
}
例如,我需要检查所有评论日期。我写了这段代码:
UpdateOperations<Blog> ops;
Query<Blog> updateQuery = ds.createQuery(Blog.class).disableValidation().filter("comment.$.date", "some date").enableValidation();
ops = ds.createUpdateOperations(Blog.class).disableValidation().set("comment.$.text", "new text").enableValidation();
ds.update(updateQuery, ops);
但它不起作用。你能告诉我如何处理吗啡中的对象数组吗?