SocialProfileSchema = new mongoose.Schema
source:
type: String
enum: [\'twitter\',\'facebook\']
lowercase: true
user_id: String
profile_url: String
p
Here's an example of how you can do an update if exists, otherwise insert:
Arguments for update are: findQuery, data, queryOptions, onComplete
var update = { data: "1", expires: 300 };
that.update({ session_id: sid }, { $set: update }, { upsert: true }, function(err, data) {
callback.apply(this, arguments);
});
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