-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Cannot read property 'apply' of undefined\n at Buffer.MongooseBuffer.mixin.copy #7102
Comments
@rajveerg can you provide more detailed code samples? Schemas, webpack config, etc. would be very helpful. |
I have (had) the same problem after upgrading from an ancient mongoose version to 5.3.4. |
I was able to repro this with the following script on node 4.2.3 ( this works as expected on newer versions, e.g. node v4.9.1 and v10.11.0 ): 7102.js#!/usr/bin/env node
'use strict';
const co = require('co');
const assert = require('assert');
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const connection = mongoose.connection;
const DB = '7102';
const URI = `mongodb://localhost:27017/${DB}`;
const OPTS = { family: 4, useNewUrlParser: true };
mongoose.connect(URI, OPTS);
const schema = new Schema({
buf: Buffer
});
const Test = mongoose.model('test', schema);
const test = new Test({ buf: [1,2,3] });
function run() {
return co(function*() {
assert.strictEqual(process.version, 'v4.2.3');
assert.strictEqual(mongoose.version, '5.3.4');
yield connection.dropDatabase().catch(error);
yield test.save().catch(error);
console.log('All Assertions Pass.');
return connection.close().catch(error);
});
}
run();
function error(e) {
console.error(e.stack);
} Output:
|
Thanks @lineus for providing stuff to reproduce the issue. Issue is I have to stick to node 4.2.3 and also have to upgrade mongodb 3.6.x and compatible ODM mongoose ^5.0. Is there a fix to solve the issue. |
Thanks @lineus , will fix this ASAP |
Thanks @vkarpov15 for taking this on priority. |
I have reactjs application running on nodejs_4.2.3 using MongoDB_3.0.12 and the ODM as mongoose_^4.3.1. Now I have fallen in to a case to upgrade to MongoDB_3.6.2 and the compatible ODM driver as mongoose_^5.0.0 on the same legacy node version.
Now if I try to persist a mongoose schema model I am getting the below error.
could someone point me in right direction to solve this issue. Help is appreciated
The text was updated successfully, but these errors were encountered: