Redeem the last MongoDB record

0

I'm trying to redeem only the last record from a collection in Mongo and Mongoose.

Passing this command:

db.measurements.findOne().sort({ field: 'updated', _id: -1 })

The following error appears:

2018-12-13T13:12:25.702-0200 E QUERY    [thread1] TypeError: db.measurements.findOne(...).sort is not a function :
@(shell):1:1
    
asked by anonymous 13.12.2018 / 16:19

0 answers