Q:

how to insert the current date in mongoose using nodejs

I am trying to insert the current date for every user but I get an error like this:

throw er; // Unhandled 'error' event
        ^
TypeError: callback.apply is not a function
      at F:\epaper\sakshi\epaper\node_modules\mongoose\lib\model.js:3954:16
      at process.nextTick (F:\epaper\sakshi\epaper\node_modules\mongoose\lib\query.js:2022:28)
      at _combinedTickCallback (internal/process/next_tick.js:131:7)
      at process._tickDomainCallback (internal/process/next_tick.js:218:9)

Can anyone please help me? 
MODEL:  
const ClipsSchema = new mongoose. Schema({
   x1:Number,
   x2:Number,
   y1:Number,
   y2:Number,
   height:Number,
   width:Number
});

const UserSchema = new mongoose. Schema({
   dist_id : Number,
   path: [{body:String,date : Date}],
   date: { type: Date, default: Date.now },
   clips : [ClipsSchema]  
});

RESOLVER:
const x1 = param.x1;
         console.log(x1)
       const  x2 = param.x2;
        const y1 = param.y1;
        const y2 = param.y2;
         const height = param.height;
        const width = param.width;
        const data={"x1":x1,"x2":x2,"y1":y1,"y2":y2,"height":height,"width":width};
        console.log(data)
        var date = new Date();
        //var bongu = await Urls({date : ddd}).save()
        //console.log(bongu) 

                //const details= await Urls.findOneAndUpdate({dist_id:dist_id}, {clips:[{x1:x1,x2:x2,y1:y1,y2:y2,height:height,width:width}]});
        const details= await Urls.findOneAndUpdate({dist_id:dist_id},{$push: {clips:data} },{$set: {date : date }},{ upsert: true });
        console.log(details)
      // const update =  Urls.findOneAndUpdate({_id:details._id},{$set : {date:ddd}})
        //const sss = await Urls.find({_id : details._id})
        //console.log(sss)
        var status = {};
        status.status="User Created Successfully";
        return status;

A:

Mongoose findOneAndUpdate accepts 4 arguments:

[conditions] «Object»
[update] «Object»
[options] «Object» optional see Query.prototype.setOptions()
[options.lean] «Object» if truthy, mongoose will return the document
  as a plain JavaScript object rather than a mongoose document.  See
  Query.lean(). 
[callback] «Function»

Operators should be passed as single object but they are different objects, and options argument is treated as 4th parameter (callback).  Since it's not a function, it throws an error on call. 
It likely should be:
Urls.findOneAndUpdate(
  {dist_id:dist_id},
  {$push: {clips:data}, $set: {date : date }},
  { upsert: true }
);

