Answer the question
In order to leave comments, you need to log in
How to fix Mongo error?
We have an error:
{ MongoError: Mod on _id not allowed
at Function.MongoError.create (/root/projects/datakeeper/node_modules/mongoose/node_modules/mongodb-core/lib/error.js:31:11)
at toError (/root/projects/datakeeper/node_modules/mongoose/node_modules/mongodb/lib/utils.js:114:22)
at /root/projects/datakeeper/node_modules/mongoose/node_modules/mongodb/lib/collection.js:1007:60
at getLastErrorCallback (/root/projects/datakeeper/node_modules/mongoose/node_modules/mongodb-core/lib/wireprotocol/2_4_support.js:462:20)
at Callbacks.emit (/root/projects/datakeeper/node_modules/mongoose/node_modules/mongodb-core/lib/topologies/server.js:119:3)
at .messageHandler (/root/projects/datakeeper/node_modules/mongoose/node_modules/mongodb-core/lib/topologies/server.js:358:23)
at Socket.<anonymous> (/root/projects/datakeeper/node_modules/mongoose/node_modules/mongodb-core/lib/connection/connection.js:292:22)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:172:18)
at Socket.Readable.push (_stream_readable.js:130:10)
at TCP.onread (net.js:542:20)
name: 'MongoError',
message: 'Mod on _id not allowed',
driver: true,
ok: 1,
n: 0,
code: 10148,
errmsg: 'Mod on _id not allowed',
writeConcernError: { code: 10148, errmsg: 'Mod on _id not allowed' } }
var session = require('express-session');
var MongoStore = require('mongoose-session')(mongoose);
app.use(session({
genid: function(req) {
return uuid.v4();
},
saveUninitialized: false,
resave: true,
cookie: {
name: config.get('session_cookie_name'),
maxAge: (60*60*1000*24),
secure: true
} ,
key: config.get('session_cookie_name'),
secret: config.get('session_cookie_secret'),
proxy: true,
store: MongoStore
}));
MongoDB shell version: 2.4.9
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question