Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用Morphia将对象集合保存到MongoDB?_Java_Mongodb_Morphia - Fatal编程技术网

Java 如何使用Morphia将对象集合保存到MongoDB?

Java 如何使用Morphia将对象集合保存到MongoDB?,java,mongodb,morphia,Java,Mongodb,Morphia,我目前正在迭代一组对象并逐个保存它们。我想有办法直接保存整个收藏吗 注意,我以后需要能够从DataStore类的javadoc检索每个单独的对象(而不是整个集合)。。在旧版本上可能不可用。甚至我认为这是一次内部迭代和保存一个,但它可能会得到优化,所以使用它比自己迭代要好 <T> Iterable<Key<T>> save(Iterable<T> entities) Saves the entities (Objects) an

我目前正在迭代一组对象并逐个保存它们。我想有办法直接保存整个收藏吗


注意,我以后需要能够从DataStore类的javadoc检索每个单独的对象(而不是整个集合)。

。在旧版本上可能不可用。甚至我认为这是一次内部迭代和保存一个,但它可能会得到优化,所以使用它比自己迭代要好

<T> Iterable<Key<T>>
save(Iterable<T> entities) 
          Saves the entities (Objects) and updates the @Id field
<T> Iterable<Key<T>>
save(Iterable<T> entities, com.mongodb.WriteConcern wc) 
          Saves the entities (Objects) and updates the @Id field, with the WriteConcern
<T> Iterable<Key<T>>
save(T... entities) 
          Saves the entities (Objects) and updates the @Id field
Iterable
保存(可编辑实体)
保存实体(对象)并更新@Id字段
可迭代的
保存(Iterable实体,com.mongodb.WriteConcern wc)
保存实体(对象)并使用WriteConcern更新@Id字段
可迭代的
保存(T…实体)
保存实体(对象)并更新@Id字段
)