These are chat archives for Automattic/mongoose

9th
Jul 2017
matrixbirds
@Matrixbirds
Jul 09 2017 04:51
@davegahn u can use Promise.all
const express = require('express');
const router = express.Router();
const mongoose = require('mongoose');
const content = require('../views/data/content.json');

router.get('/', function (req, res) {
  Promise.all(mongoose.model('pic').find(), mongoose.model('reviews').find())
    .then(result => {
      res.render('pages/works', {pic: result[0], reviews: result[1]});
  })
});