分享

利用spring-data操作mongodb如何实现批量插入和批量更新问题

zuoanlove 发表于 2013-10-17 21:37:45 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 4 41243
用spring-data操作mongodb如何实现批量插入和批量更新问题?
spring-data中有类似mongodb shell中的each操作么?
该如何实现?
              
               
               

已有(4)人评论

跳转到指定楼层
luoqintao 发表于 2013-10-17 21:38:45

            spring-data,顾名思义就是要和springframework结合,具体的删除只能用java写for循环了
        
回复

使用道具 举报

tiger435 发表于 2013-10-17 21:39:39

            spring-data中有封装批量插入和更新的方法
批量插入:MongoTemplate.insertAll(Collection objectsToSave)
批量更新:MongoTemplate.updateMulti(Query query, Update update, Class entityClass)
        
回复

使用道具 举报

zuoanlove 发表于 2013-10-17 21:40:29

            引用 2 楼 tiger435 的回复:spring-data中有封装批量插入和更新的方法
批量插入:MongoTemplate.insertAll(Collection objectsToSave)
批量更新:MongoTemplate.updateMulti(Query query, Update update, Class entityClass)
……
有这个?你用的哪个版本呀?
        
回复

使用道具 举报

tiger435 发表于 2013-10-17 21:41:21

            最新版本的啊
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条