猫鼬总是返回空数组NodeJS
find
findOne
find
findOne
null
. err
null
function connectToDB(){ mongoose.connect("mongodb://localhost/test"); //i have also tried 127.0.0.1 db = mongoose.connection; db.on("error", console.error.bind(console, "connection error:")); db.once("open", function callback(){ console.log("CONNECTED"); });};
var fileSchema = mongoose.Schema({ hash: String, type: String, extension: String, size: String, uploaded: {type:Date, default:(Date.now)}, expires: {type:Date, default:(Date.now()+oneDay)}});var Model = mongoose.model("Model", fileSchema);
Model.find({},function(err, file) { console.log(err) console.log(file); });
手掌心
qq_花开花谢_0
阿晨1998