我用nodjs用这段代码连接到mongo db:
url = require("url"),
emitter = require("events").EventEmitter,
assert = require("assert"),
mongo = require("mongodb"),
Cursor = mongo.Cursor;
var uristring = "mongodb://localhost:27017/test";
var mongoUrl = url.parse (uristring);
mongo.MongoClient.connect (uristring, function (err, db) {
db.collection ("test", function (err,collection) {
collection.find({},{name:1,_id:0}).toArray(function(err, results) {
console.log(results);
});
});
});
但是当我向数据库插入内容时,我应该再次查询以显示更改。 python.how每隔毫秒更新数据库以查看更改?我应该在我的数据库和节点之间使用socket io吗?