Js asynchronous calling sequence

  node.js, question

In the process of inserting dozens of records into mongodb, I found a problem, that is, I don’t know when to complete the insertion. The code is as follows:

var tmp1=JsonObj.RECORDS;
 collection.insertMany(tmp1, {safe: true}, function (err, result) {
 console.log('----111111!'  );
 });
 console.log('----22222222!'  );

It was found that the first output was “-22222222!”
How to control must first output “-11111111!” After that is “-222222!” ? Because sometimes it has to be done.
Beginners sincerely ask for help, thank you.

Theconsole.log('----22222222!' );In the callback function,console.log('----111111!' );The back of the.