java - Mongo DB eval nolock:true -


hi,
running eval script node js making nolock true disable global lock.the same eval script running java nolock true.

string jsfunction = "function(){"                           + "var uid = 12;"                             + "return refreshlist(uid,false);}"; dbobject commandobj = new basicdbobject(); commandobj.put("eval", jsfunction); commandobj.put("nolock", true); commandresult status =db.command(commandobj); db.eval("function (x, isoverwrite) { return refreshlist(x, isoverwrite);}",                                                              [21,isoverwrite] ,{nolock:true}, function(err, result){     }); 

in java while running script there no lock in db , can able run query simultaneously.but in node js running above code no able other process simulatneously.i not able see lock logs in mongodb console also. don't know why behaviour changes in both. tried using command query in node js got same issue.

by default, eval function take , hold global write lock. setting nolock true doing preventing lock being taken eval. setting nolock not impact whether operations within javascript code takes write lock, update, insert, findandmodify etc. operation perform in code still take lock other write operation (for reference, straight docs).

there no alternative or way around this, can't write data database without impacting locking, if writing data (including updates) have take write lock. running operations server side , inside eval statement not change that.

it's worth noting warning message have posted that, warning. means query in question tried yield (usually because doing fault disk) , not because of nature of lock held @ time - not error. recommend running outside eval block see looks , remove eval equation entirely.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -