Mongodb Morphia将项目添加到嵌入式

Mongodb Morphia将项目添加到嵌入式,mongodb,morphia,Mongodb,Morphia,我有以下结构。 产品被嵌入商店;而评论则嵌入到产品中 1- Store 2-Products[]--> 3-Reviews[] 我正在尝试使用以下代码添加一个要查看的新项目。它没有给我一个错误,但也没有添加错误 Query q1=ds.createQuery(Product.class).filter("Code", code); if(q1.countAll()==1) { ops = ds.createUpdateOperations(Product.c

我有以下结构。 产品被嵌入商店;而评论则嵌入到产品中

1- Store
  2-Products[]-->
     3-Reviews[]
我正在尝试使用以下代码添加一个要查看的新项目。它没有给我一个错误,但也没有添加错误

Query q1=ds.createQuery(Product.class).filter("Code", code);
if(q1.countAll()==1)
    {
    ops = ds.createUpdateOperations(Product.class).add("Reviews", review);
    ds.update(q1, ops);
    }

我想出来了。唯一的是对嵌入式产品的查询,通过添加新的审阅对其进行了修改,并使用ds.CreateUpdateOperations().Set(ops)更新该产品