Skip to content

Commit

Permalink
get count from DB
Browse files Browse the repository at this point in the history
  • Loading branch information
rharlev committed Mar 14, 2020
1 parent 64e1f53 commit bae7858
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ const xget_meta = async (req, res, next) => {
let query = {};
query['_box'] = req.box;

// get record count
const record_count = await Data.count(query).exec();

// get first _createdOn
let sort = '_createdOn'
const record_createdOn = await Data.findOne(query).sort(sort).exec();
Expand All @@ -45,6 +48,7 @@ const xget_meta = async (req, res, next) => {
let updatedOn = record_updatedOn["_updatedOn"]

result = {
"count": record_count,
"createdOn": createdOn,
"updatedOn": updatedOn
}
Expand Down

0 comments on commit bae7858

Please sign in to comment.