Golang更新mongodb中的现有文件 [英] Golang update existing file in mongodb

查看:284
本文介绍了Golang更新mongodb中的现有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个接收并保存mongodb文件的api,基于golang的my api和使用mgo与mongodb一起工作,所以mgo文档说已存在的文件不能更新,但在我的应用程序中有一个函数接收分块文件,并应写入文件。
我已经搜索并没有找到任何解决方案,有些链接或文章会有所帮助。

知道你在mgo文档中看到了什么,但你可以使用mgo绝对更新Mongo中的文档,如 mgo文档,特别是函数 Update UpdateId UpdateAll Upsert UpsertId


I have created api which receive and save files into mongodb,My api based on golang and using mgo to work with mongodb, So mgo documentation says that the files which already exists can not be update, but in my app there is a function which receive a chunked files and should write on file. I have googled and have not found any solution, some links or articles will be helpful

解决方案

I don't know where you saw that in the mgo documentation but you can absolutely update documents in Mongo using mgo, as evidenced by the mgo documentation, particularly the functions Update, UpdateId, UpdateAll, Upsert, and UpsertId.

这篇关于Golang更新mongodb中的现有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆