-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
enhancementThis issue is a user-facing general improvement that doesn't fix a bug or add a new featureThis issue is a user-facing general improvement that doesn't fix a bug or add a new feature
Milestone
Description
The below currently throws cast error:
const mongoose = require('mongoose');
mongoose.set('debug', true);
run();
async function run() {
await mongoose.connect('mongodb://localhost:27017/test');
const Model = mongoose.model('Foo', new mongoose.Schema({
buf: Buffer
}));
const doc = await Model.create({
buf: {
type: 'Buffer',
data: [ 72, 101, 108, 108, 111, 44, 32, 87, 111, 114, 108, 100 ]
}
});
}
That's bad because the output JSON.stringify({ buf: Buffer.from('test') });
is '{"buf":{"type":"Buffer","data":[116,101,115,116]}}'
Metadata
Metadata
Assignees
Labels
enhancementThis issue is a user-facing general improvement that doesn't fix a bug or add a new featureThis issue is a user-facing general improvement that doesn't fix a bug or add a new feature