node-orm2
node-orm2 copied to clipboard
double find will return wrong data
such as this: models.users.find().only("email", "name", "admin", "created_at").run(function(err, users){ if(err){ throw err; } console.log(JSON.stringify(users)); res.json(users); }); when i run this function twice, except first run, Behind results will only have the last data.
such that
models.users.find().only("email", "name", "admin", "created_at").run(function(err, users){
if(err){
throw err;
}
console.log(JSON.stringify(users));
});
models.users.find().only("email", "name", "admin", "created_at").run(function(err, users){
if(err){
throw err;
}
console.log(JSON.stringify(users));
});
models.users.find().only("email", "name", "admin", "created_at").run(function(err, users){
if(err){
throw err;
}
console.log(JSON.stringify(users));
});
it will return [{"email":"[email protected]","passwd":null,"admin":true,"name":"ddd","image":null,"created_at":1438508370808,"id":null},{"email":"[email protected]","passwd":null,"admin":true,"name":"ddd","image":null,"c reated_at":1438508516420,"id":null},{"email":"[email protected]","passwd":null,"admin":true,"name":"ddd","image":null,"created_at":1438572358034,"id":null}] [{"email":"[email protected]","passwd":null,"admin":true,"name":"ddd","image":null,"created_at":1438572358034,"id":null},{"email":"[email protected]","passwd":null,"admin":true,"name":"ddd","image":null ,"created_at":1438572358034,"id":null},{"email":"[email protected]","passwd":null,"admin":true,"name":"ddd","image":null,"created_at":1438572358034,"id":null}] [{"email":"[email protected]","passwd":null,"admin":true,"name":"ddd","image":null,"created_at":1438572358034,"id":null},{"email":"[email protected]","passwd":null,"admin":true,"name":"ddd","image":null ,"created_at":1438572358034,"id":null},{"email":"[email protected]","passwd":null,"admin":true,"name":"ddd","image":null,"created_at":1438572358034,"id":null}]
models.users.find(function(err, users){
if(err){
throw err;
}
console.log(JSON.stringify(users));
});
if i use this code it will return true result chain has a bug?
一看这英语不用猜就知道肯定是中国人。。
yes, I set it like:
var opts = {
database: "inspiration",
protocol: "mysql",
host: "127.0.0.1",
port: 3306,
username: "root",
password: "root",
query: {
debug : false,
pool: true
}
};
it can print many detail info,contain query sql, but It's hard to find。
i can only user this command to mysql now:
SHOW VARIABLES LIKE "general_log%";
SET GLOBAL general_log = 'ON';
Can you change it to: query: { debug2: true } and then change this line to
if (this.opts.debug2) {
I suspect the newer versions of mysql driver also use the debug flag and it causes a lot of noise. It works fine with postgres and sqlite.
:ok:
Hey, I fixed the noisy mysql debug output and released version v2.1.27 Please update rather than using the hack above.