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
1
vote
0 answers

How to resize images stored using multer-gridfs-storage when displaying them

These are the variables for the route below the const GridFsStorage = require("multer-gridfs-storage"); const Grid = require("gridfs-stream"); var conn = mongoose.createConnection(db, { useNewUrlParser: true, useUnifiedTopology: true, }); let…
user11720628
1
vote
1 answer

Retrieve files from MongoDB using pymongo and gridfs for files larger than 16mb

So I am trying to upload data larger than 16mb on a local database on an Azure Cosmos Emulator from a python app. The upload is perfect it creates the chunks along with the items. The problem I have though is on the download. path = "eye1.zip" fs =…
1
vote
0 answers

How to upload an image to GridFS using gridfs-stream?

I have the following code, in which I'm using GridFS-stream to upload an image to my mongodb database that's called "test". const formidableMiddleware = require('express-formidable'); var GridFS = Grid("test", mongoose.mongo); …
zengod
  • 1,114
  • 13
  • 26
1
vote
1 answer

POST file using request, gridfs-stream and multer

In my node.js-application, I need to read data from a MongoDB with GridFS and upload it to another server via POST request, I am using the modules gridfs-stream, request and multer. According to the request docs I can simply add a stream for…
Guest9875
  • 63
  • 1
  • 2
  • 8
1
vote
1 answer

Why isn't this exported Gridfs function executing correctly?

I am working on a React application with a node and mongo backend. The mongo backend is going to be storing images using Gridfs-stream. I have implemented the saving of images successfully, but now am having trouble pulling specific images from the…
Zach Dobbs
  • 63
  • 1
  • 7
1
vote
1 answer

Getting error while trying to save file in grid-fs using mongoose and nodejs

Trying to get GridFSBucket working for mongoose but no luck even after spending 2 days on it. I was getting a warning related to GridStore so thought of using GridFSBucket as we are using mongoose so referred the link but the same code is not…
eduPeeth
  • 1,840
  • 13
  • 21
1
vote
1 answer

Hard time understanding gridfs and connections

So I watched this video: https://youtu.be/EVIGIcm7o2w And it explained a lot of stuff. But the problem is I already have a project created with Express so my connection is done in app.js like this: // mongodb connection var mongoose =…
Alex Ironside
  • 4,658
  • 11
  • 59
  • 119
1
vote
2 answers

Getting error in uploading image to mongo DB using multer and multer-gridFs-storage

TypeError: Cannot read property 'readPreference' of undefined E:\CapstoneProject\Express_ws\FoodCourtServer\node_modules\mongodb\lib\gridfs\grid_store.js:134 this.options.readPreference || db.options.readPreference || ReadPreference.primary; …
1
vote
1 answer

passing mongoose as an argument to a function

I'm developing a node module. I need to pass the mongoose to my module to get three things (mongoose.connection, mongoose.connection.db, mongoose.mongo) out of it. index.js (myModule - the module I developed) function myModule(mongoose) { var db…
Kasra GH
  • 157
  • 2
  • 5
  • 22
1
vote
0 answers

Node + mongo gridfs atomicity

Mongo can't natively guarantee atomicity for multi-document transactions. Considering that the method of storing files via mongo's gridfs functionality (I'm using gridfs-stream from npm) involves creating multiple documents, I was wondering if it is…
Gershom Maes
  • 7,358
  • 2
  • 35
  • 55
1
vote
1 answer

Error cannot be caught with Express.js and gridfs-stream

It's an easy image (picture) download server, Express.js receives the request, gets an image from MongoDB GridFS, and responds with the file. It's OK when request is valid (when the requested file exists). The problem is that I cannot catch the…
raaay0608
  • 105
  • 9
1
vote
0 answers

Display image in my HTML from GridFS

I've checked this post and this post and they don't work. I successfully store an .png image in mongodb using gridfs-locking-stream and also retrieve that picture. this is how the database look like after executing the db.fs.files.find().pretty()…
Kasra GH
  • 157
  • 2
  • 5
  • 22
1
vote
0 answers

File upload to Mongodb through heroku with gridfs bucket doesn't work

The moment I try to upload a file with heroku to the database it won't work. If I do it with localhost it does work. Anybody has an idea why heroku is not handling my file when I try to upload a file to it? Does someone know a fix? I am kind of new…
Markie Doe
  • 115
  • 1
  • 9
1
vote
0 answers

How to connect to the database:mongoose?

Below is my code:The folder and filename is : gridFs/storeAudio.js.And the code is in storeAudio.js var mongoose = require('mongoose'); var fs = require('fs'); var Grid = require('gridfs-stream'); Grid.mongo=mongoose.mongo; //establish mongoDB…
Aditya
  • 2,358
  • 6
  • 35
  • 61
1
vote
1 answer

close or finish event of writestream not fired gridfs

I am trying to write a file into MongoDB using mongoose and GridFS. However, gridfs writestream is not firing any of the events - close or finish. Also, it is not firing even the 'error event'(Just in case if there is any error). My nodejs version…
Pramod Sharma
  • 376
  • 5
  • 14