A11yWatch/a11ywatch-core

View on GitHub
src/core/utils/get-last-item-in-collection.ts

Summary

Maintainability
A
0 mins
Test Coverage
export const getLastItemInCollection = async (
  collection: any,
  searchBy: any
) => {
  return await collection
    .find({ [searchBy]: searchBy })
    .sort({ _id: -1 })
    .limit(1)
    .toArray();
};