node.js - Mongoose Exclude a field if it doesn't match but not the doc -


i've got invitation system , want know if user has been invited or not. every time user invited, notification array updated targeted offer's id.

  • model

    ... notification:[     {   offer: {type:schema.types.objectid, ref:'offer'},         invitor:{type:schema.types.objectid, ref:'user'},         createat: {type:date, default:date.now()}     }             ] .... 

so goal when query user display notification field if offer's id in notification's array , not if doesn't contain it.


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -