Preview:
const query = {}; // Your query conditions go here

const [resultData, totalCount] = await Promise.all([
  User.find(query)
    .skip((page - 1) * limit)
    .limit(limit),

  User.countDocuments(query),
]);

console.log(resultData);
console.log(totalCount);
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter