• Mongoose and node.js query two fields at once from mongodb

    abemassry        
    1 Likes0 Commentsjavascript

    models.articles.find( { $or: [ {title: query}, {body: query}]}).limit(30).sort('-date').exec(function(err, data){
      if(err) { throw err; }
      res.render('results.jade', {
        locals: {
          page: 'results',
          results: data,
          query: query
        }
      });
    });

Comments (0)