Can someone help me understand what I'm dong wrong. I'm trying to fetch the last recorded ID in my mongodb collection
db.collection('task').findOne(({_id: new ObjectID}).sort('_id:: -1').limit(1), (error, task) => {
if(error){
return console.log('There is no data inside the collection')
}
})