This operation is not allowed, Current connection is readonly when use mapreduce

Richard Mao shared this question 2 years ago
Answered

db.loan.mapReduce(

function () {

var stats = {

"xxx":0,

"xxx":0,

"xx":0,

};

xxxx

emit(123.length, 345);

},

function (key, values) {


var reducedStats = {

"xxx":0,

"xxx":0,

"xxx":0,

};


xxxxx

return reducedStats;

},

{

out: { inline: 1 },

query: {loanCategory:"CONSUMER", datePublished:{$exists: true}},

sort: {},

}

)


Why it shows This operation is not allowed, Current connection is readonly.

Replies (1)

photo
1

In MongoDB, the map-reduce operation is a mutable command. The map-reduce operation can write results to a collection or return the results inline. To use it, you have to turn off the read-only locker.

/a933e6ef6d9d95e0ac7d829c47a314cb

Leave a Comment
 
Attach a file