admin.js 412 B

12345678910111213141516171819
  1. var User = require('../models/User');
  2. let Watch = require('../models/Watch');
  3. var mongoose = require('mongoose');
  4. exports.listWatches = (req, res) => {
  5. Watch.find({}, null, { sort: '-year' }, function (err, watch) {
  6. if (err) {
  7. console.log(err);
  8. } else {
  9. res.render('account/list-watches', {
  10. title: 'List watches',
  11. watch: watch
  12. });
  13. }
  14. }).populate('criador');
  15. }