Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSS

Return certain fields with populate from mongoose

Model
.find(query)
.populate({
  path: 'key_with_ref',
  model: 'model_name',
  select: { 'field_name': 1,'field_name':1},
})
 
-OR-

Model
.find(query)
.populate({
  path: 'key_with_ref',
  model: 'model_name',
  select: 'field_name, field_name',
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Return #fields #populate #mongoose
ADD COMMENT
Topic
Name
3+7 =