Questions tagged [gridfs-stream]

gridfs-stream is a node.js module that provides streams for writing to and reading from GridFS on MongoDB.

For more information, visit gridfs-stream's github repository.

160 questions
0
votes
0 answers

I'm having a really weird MongoDB bug

Let me start off with apologizing for my title. I'm having this weird MongoDB bug, and I truly have no idea what to name this post. I'm trying to make a simple video streaming platform using GridFS-Stream. Streaming the actual video isn't a problem.…
Gabriel Gavrilov
  • 337
  • 3
  • 11
0
votes
0 answers

Unable to render PDF to browser when retrieved from gridfs-stream

My Controller : - view: async (req, res) => { var id = req.params.pid id = mongoose.Types.ObjectId(id) const project = await Project.findById(id) const upid = project.uploadedGridFileId var uploads =…
anshu_anand
  • 69
  • 1
  • 8
0
votes
0 answers

TypeError: grid.mongo.ObjectID is not a constructor

I've got this JS code for my Next.js API. I'm trying to store images in MongoDB GridFS and retrieve them with a simple API route. The code you are seeing is from a file that gets imported in the API route. import { MongoClient } from…
QuaKe
  • 23
  • 1
  • 4
0
votes
1 answer

How can I compress an image before storing it in MongoDB using GridFS and NodeJS?

I'm trying to upload images in my NodeJS app using GridFS and MongoDB. I want to compress the image before it is uploaded in MongoDB and I've shared the GridFS middleware. I would like to know where I should put the compression code or if there is a…
impirios
  • 1
  • 4
0
votes
1 answer

gridfs-stream Image in Next js

In "pages/api", trying to print out GridFS images from MongoDB database on the client. Works in (another) MERN-Stack project but seems that I have a problem in Next.js. pages/api/uploads/files/index.js Works(I'm getting the returned files in the…
Daniel Ioanitescu
  • 187
  • 1
  • 1
  • 10
0
votes
1 answer

data saving in new collection is not working using mongoose-multi and gridfs stream?

It is not possible to share all code here, but I am going you a hint. I am adding my new collection's schema in the Schema file, which have two object global and local. global and local are our two databases. My question is Is there is anything…
0
votes
2 answers

Angular upload files to mongoDB user collection using GridFS

I am currently developing a MEAN stack web app which should allow users to upload their files to the database. I've been trying to use multer + gridfs-stream as well as multer-gridfs-storage but to no avail. This is what I currently have. //…
Brio Tech
  • 75
  • 1
  • 10
0
votes
1 answer

Uploading files with graphql to mongodb with mongoose

I want to upload file to mongodb with graphql resolver. In server.js I have this help function to store file, which is exported to use it in my resolver. The function is basing on what I found here:…
0
votes
1 answer

Display image through a html img tag stored in GridFS using Node JS

I had stored some images in grid FS using Node JS. Now I want to display those images in a html img tag. What should I do in the nodejs part for getting display that image? What should I give the value of src attribute of img tag?
MikhilMC
  • 949
  • 3
  • 8
  • 14
0
votes
0 answers

MongoDB GridFSBucket upload stream doesn't return length of base64 image stream

I'm refactoring my team code to remove Deprecation Warnings from MongoDB. I removed gridfs-stream library and I'm using GridFSBucket instead But there is a problem: upload stream using GridFSBucket doesn't return the length of base64 image, instead…
0xh8h
  • 3,271
  • 4
  • 34
  • 55
0
votes
1 answer

Set headers twice and/or not correctly handling a callback - resulting in Error [ERR_HTTP_HEADERS_SENT]

I'm getting the expected image with this code but it does not display in my pug template, instead it displays in the browser devtools console (i hope that makes sense), and it appears that I'm trying to set headers twice. My code produces…
dlw
  • 19
  • 5
0
votes
1 answer

Adding and deleting two collections with react functional components

I want to add two collections with one action. First one is file using multer and gridfs-stream and second is just literal with properties based on file. That what I achieved: 1)literal based on file and 2)file uploaded. In 1)(literal) this fileID…
Wiktor Kujawa
  • 595
  • 4
  • 21
0
votes
1 answer

Uploading files to mongodb database with multer

I can't upload files into database. It's important for me to maintain my files structure. Here's my files structure: Server:Server structure The most important flies in this case: server.js: const express = require('express'); const path =…
0
votes
1 answer

Mongoose returns undefined on a field with existing data

So I'm trying to associate GridFS collection with schema containing some of the data in it and then populating it with another model. GridFS Schema: const gfsSchema = mongoose.Schema({ filename: String }, {strict: false}); const GridFs =…
0
votes
1 answer

Using GridFS-Stream to send image file to Front-End React.js through Axios - Converting chunk to string base64

So I've successfully downloaded my image file to my MongoDB using Multer and Multer-Gridfs-Storage, but I'm having trouble retrieving it. When I tried to retrieve the data using GridFS-Stream, it came back like this previous question: GridFS : How…