xxxxxxxxxx
const customers = await Customer.find()
.sort({createdAt: -1})
.skip(1)
.limit(20)
.exec();
xxxxxxxxxx
const customers = await Customer.find()
.sort({createdAt: -1})
.skip(1)
.limit(20)
.exec();
xxxxxxxxxx
db.people.findOne()
-- or
db.people.find().limit(1)
-- sql
SELECT *
FROM people
LIMIT 1
xxxxxxxxxx
db.Employees.find().limit(1);
Where Employees is collection name
It selects first document only.