How to perform an upsert in Mongoose looking for an embedded document?

前端 未结 2 603
清歌不尽
清歌不尽 2021-01-21 00:33
SocialProfileSchema = new mongoose.Schema
  source:
    type: String
    enum: [\'twitter\',\'facebook\']
    lowercase: true
  user_id: String
  profile_url: String
  p         


        
2条回答
  •  一生所求
    2021-01-21 01:04

    How about a dbref? It will let you access the SocialProfiles directly instead of having to loop through a bunch of embedded objects

    http://mongoosejs.com/docs/populate.html

提交回复
热议问题