Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var router = require('express').Router();
- var mongoose = require('mongoose');
- var Article = mongoose.model('Article');
- // grab the distinct tags used, sorted in descending order of frequency
- router.get('/', function(req, res, next) {
- Article.find().distinct('tagList').then(function(tags){
- return res.json({tags: tags});
- }).catch(next);
- });
- module.exports = router;
Advertisement
Add Comment
Please, Sign In to add comment