Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

TypeError: Cannot read property 'readPreference' of null at new GridStore #144

@jisamathew

Description

@jisamathew

I have used below code for retreiving image from gridfs but getting error "Cannot read property 'readPreference' of null at new GridStore"

                var readstream = gfs.createReadStream({
                    filename: file.filename
                });

                //error handling, e.g. file does not exist
                readstream.on('error', function (err) {
                    console.log('An error occurred!', err);
                    throw err;
                });

                readstream.pipe(response);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions