Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is a schema-type of "GridFS" wanted? #7482

Open
mhombach opened this issue Feb 3, 2019 · 7 comments
Open

Is a schema-type of "GridFS" wanted? #7482

mhombach opened this issue Feb 3, 2019 · 7 comments
Labels
discussion If you have any thoughts or comments on this issue, please share them! new feature This change adds new functionality, like a new method or class plugin

Comments

@mhombach
Copy link

mhombach commented Feb 3, 2019

Feature-request:

As in #2631, i think many of us would love to have a clean type of "GridFS" for referencing files/chunks saved in mongoDB as GridFS.

Is this wanted as official mongoose type?
Is the implementation already on it's way?
Because i would love to help creating such a clean schema type, so that we can store files.

I now tried 2 npm packages for that, but both are really not "optimal" and are very rarely updated.

Would love to get a response/opinion from @vkarpov15 on this :)

@vkarpov15
Copy link
Collaborator

I've always been hesitant to put this into core mongoose because in my experience there's rarely a reason to use gridfs. Storing the file on S3 and then storing the URL in MongoDB is generally much easier. I would be open to a plugin though.

@mhombach
Copy link
Author

mhombach commented Mar 6, 2019

@vkarpov15 After thinking about this for some time, i have to admit that i share your opinion on storing binary data somewhere else (local, ftp, smb, S3 or whatever place).
I just do have the feeling, that core-support for gridfs should "belong" to mongoose, since mongoose is, if you will, a wrapper/overlay ontop of mongodb. And from my personal feeling,i would think, that over time we should try to support every feature that mongodb natively supports.
So... if someone wants to switch to mongoose (coming from plain mongodb/js-coding) and they are storing their data by using gridfs, they would need to change their whole storage-mechanics...
Again, i am not saying that storing data in gridfs is the prefered and best way. I just feel, that since it's officially and natively supported and implemented in mongodb, it somehow "belongs" to mongoose (imho).
Now there's the philosophically question if just because this feature somewhat belongs to mongoose, if it also SHOULD be implemented, even if maybe not many users will use this... Not sure about what the best answer is there :/

@vkarpov15
Copy link
Collaborator

That's a fair point. I suppose there's some value Mongoose can provide with populate() as well. Will keep this open for future work.

@vkarpov15 vkarpov15 added this to the 5.x Unprioritized milestone Mar 11, 2019
@vkarpov15 vkarpov15 added new feature This change adds new functionality, like a new method or class discussion If you have any thoughts or comments on this issue, please share them! labels Mar 11, 2019
@Chukstart
Copy link

Has anyone implemented a plugin for this yet the code in a production environment becomes a general headache when handling lets say various routes

@vkarpov15
Copy link
Collaborator

@Chukstart not that I know of yet.

@vkarpov15
Copy link
Collaborator

@Chukstart can you please open up a new issue and follow the issue template? Your question is too vague for me to provide a meaningful answer.

@abskmj
Copy link

abskmj commented Sep 20, 2020

I have put together a reusable Mongoose Schema for GridFS at https://github.com/abskmj/gridfile. It has generic methods to interact with GridFS and supports populating other schemas. This might help you and/or others out there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion If you have any thoughts or comments on this issue, please share them! new feature This change adds new functionality, like a new method or class plugin
Projects
None yet
Development

No branches or pull requests

4 participants