简体   繁体   English

如何使用mongodb文件保存文档

[英]How to save a document with a file mongodb

I want to save a document(a person's information) in mongodb, with a pdf File uploaded and added in it(CV) which means each document is related with a file. 我想在mongodb中保存一个文档(一个人的信息),并上传并添加一个pdf文件(CV),这意味着每个文档都与一个文件相关。 There is GridFS, i found that files are stored in two specific collections: files and chunk. 有GridFS,我发现文件存储在两个特定的集合中:文件和块。

Is there any method to save document with reference file in it, or a way to map relationships between documents and stored files ? 有没有什么方法可以将文档和参考文件一起保存,或者有一种映射文档和存储文件之间关系的方法?

Thank you. 谢谢。

i resolved this problem: i uploaded a MultipartFile, transfered it to a directory and then linked its objectId to a document, please check my answer in this link 我解决了这个问题:我上传了MultipartFile,将其传输到目录中,然后将其objectId链接到文档,请在此链接中查看我的答案

Could not Upload File using MongoDb GridFs 无法使用MongoDb GridFs上传文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM