何らかの理由で、ローカルで実行すると次のものがリモート mongo サーバーに挿入されますが、appfogサーバーで実行すると挿入されません。
function record_visit(req, res){
res.write("<br/>Connecting to "+mongourl+"<br/>");
mongo.connect(mongourl, function(err, conn){
res.write("<br/>mongo.connect success. Err = "+err+"<br/>");
conn.collection('ips', function(err, coll){
res.write("<br/>conn.collection called on collection ips, err = "+err+"<br/>");
object_to_insert = { 'ip': req.connection.remoteAddress, 'ts': new Date() };
coll.insert( object_to_insert, {safe:true}, function(err){
res.write("Inserted in collection 'ips' Err= "+err);
res.end('<br/>Done\n');
});
});
});
}
私の出力は次のとおりです。
Connecting to [correct authenticated url to mongo here]
mongo.connect success. Err = null
conn.collection called on collection ips, err = null
Inserted in collection 'ips' Err= null
Done
どこかにアクセス許可を指定する必要がありますか?