const results = await collection.find({
category: 'electronics',
}, {
sort: { price: 1 },
limit: 10,
timeout: 10000,
});
You can also use fluent builder methods on the cursor:
const cursor = collection.find({ category: 'electronics' })
.sort({ price: 1 })
.limit(10)
.skip(5);
const results = await cursor.toArray();
Overview
The options for a
findcommand on a Collection.