Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 3x 3x | import { productDataTypes } from "../../CONSTANT/projections.js";
import ProductsModel from "../../models/Products.js"
export default async function getTopProducts(limit = 10) {
try {
return await ProductsModel
.find({}, productDataTypes.basic)
.sort({ sold: -1, earnings: -1 })
.limit(limit)
} catch (error) {
console.log(error)
return null;
}
}
|