Mongoose operation of mongo DB database

  node.js, question

When I was studying mongoose, I encountered such a problem. I created a database called’ runoob’ and wrote a piece of data:
Then I use mongoose to operate the database and write data:
图片描述

mongoose.connect('mongodb://localhost/runoob');
 
 var Tasks = new mongoose.Schema({
 title:String,
 likes:Number,
 url:String
 });
 
 
 var Task = mongoose.model('Task',Tasks);
 
 var task = new Task();
 task.title = 'hhhh';
 task.likes = 130;
 task.url = 'www.zhihu.com';
 task.save(function(err){
 if (err) throw err;
 console.log('Task saved')
 });
 
 Task.find({'title':'hhhh'},function(err,tasks){
 if (err) throw err;
 for (var i=0;  i<tasks.length;  I plus)
 Log ('id:' plus tasks[i]._id);
 Log ('url:' plus tasks[i].url)
 bracket
 });

The results are as follows:
图片描述

However, I entered the database again and found that this data could not be found at all. What is the problem? What should I do?

task.save(function(err){
 if (err) throw err;
 console.log('Task saved')
 
 Task.find({'title':'hhhh'},function(err,tasks){
 if (err) throw err;
 for (var i=0;  i<tasks.length;  I plus)
 Log ('id:' plus tasks[i]._id);
 Log ('url:' plus tasks[i].url)
 bracket
 });
 });

findWhen the data is not yet availablesaveSuccess,saveIt is only after success that the pullback takes place. At this timefindThere will be data