2013年1月5日星期六

MongoDB : db.loadServerScripts(); 载入的函数调用split失败的问题


服务器定义某个函数

db.system.js.save({
_id : 'somefunc',
value :
function(d) {
// ....
s = split(/\s+/, somestring);
// ...
});

调用somefunc函数时,会提示不能做split:
db.loadServerScripts();
somefunc(somedata);

把 s = split(/\s+/, somestring); 改成 s = somestring.split(/\s/+); 就行了

没有评论:

发表评论