Skip to content

Instantly share code, notes, and snippets.

@victorkurauchi
Created May 22, 2014 17:39
Show Gist options
  • Save victorkurauchi/0690a2e66a6edd2f9c49 to your computer and use it in GitHub Desktop.
Save victorkurauchi/0690a2e66a6edd2f9c49 to your computer and use it in GitHub Desktop.
Article.find()
.where('tripleSpotlight').equals('true')
.where('columnist').equals('null')
.sort({'date.created': 'desc'}).limit(3).exec (err, inlineSpotlights)-> #first created to last created
a = new Array
idx = 0
inlineSpotlights.forEach (item)->
item = item.toObject()
category.model.findOne({'id':item.category}).exec (err, categories)->
categories = categories.toObject()
item.categoryDescription = categories.name
a.push(item) #last created to first
idx++
if a.length is idx
inlineSpotlight['list'] = a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment