-
Notifications
You must be signed in to change notification settings - Fork 120
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
DeprecationWarning: GridStore is deprecated #135
Comments
(node:3209) DeprecationWarning: GridStore is deprecated, and will be removed in a future version. Please use GridFSBucket instead |
@Yaxian Yaxian @venkyyPoojari any solution do you have as of now ? |
sorry, I have no idea
…On Mon, Oct 8, 2018 at 6:23 PM shashi ***@***.***> wrote:
@Yaxian <https://github.com/Yaxian> Yaxian @venkyyPoojari
<https://github.com/venkyyPoojari> any solution do you have as of now ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#135 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AJQhHYMpqiuMkqpeRmvHU6l9yy5UJocbks5uiyeWgaJpZM4WmlEp>
.
|
I dont have any solution as of now !! |
The mongoose docs at https://mongoosejs.com/docs/deprecations.html#-gridstore- indicates the reason for the depreciation warning and path forward:
There is also a link on that site that provides usage examples of GridFSBucket. |
then how can i read the stream. |
import {GridFSBucket, MongoClient, ObjectId} from 'mongodb';
import { Readable } from 'stream';
let connection = MongoClient.connect(url, {
useNewUrlParser: true,
useUnifiedTopology: true
} );
let db = connection.db(dbName);
let gridfsBucket = new GridFSBucket(db, {bucketName: bucketName});
let downloadStream = gridfsBucket.openDownloadStream(new ObjectId(_id));
let buffer = [];
downloadStream.on('data', (chunk) => {
buffer.push(chunk);
});
downloadStream.on('end', () => {
let readable = new Readable();
readable._read = () => {};
readable.push(Buffer.concat(buffer));
readable.push(null);
}); |
How about the function |
Also |
what exactly is _id, if it is not the file name how can I find id from filename? |
you can instead query bucketName.files with mongoose it is not too bad |
do I need to use mongoose find query on top of that? |
Here's how I did it:
|
mongodb
version is3.1.1
The text was updated successfully, but these errors were encountered: