How to reject first insert, If last insert get error (multiple inserts of collections)?

I would like to reject if have insert problem with multiple collection insert at the same time.

CollectionA.insert(data, (error, _id)=>{

If get error of CollectionB, the CollectionA is rejected too.
Please help me.

Try this:

CollectionA.insert(data, (error, _id)=>{
if (_id) { 
// _id returns a value if the insert is successfully and error if not.

   CollectionB.insert(data, (error, _id2) => {
if (error) {
 // error here means CollectionB insert failed.
// Remove previous successfully insert _id from CollectionA

   CollectionA.remove({_id: _id});
// you should probably throw an Error here

I have used this method before to implement minor transaction.

Thanks for your reply.