node.js - MongoDB: How to get data by join -




i having following 2 schemas in mongodb

var userschema = new schema({   first_name:  string,   last_name: string,   email:   string });  var messageschema = new schema({   sender: {type: schema.types.objectid, ref: 'users' },   receiver: {type: schema.types.objectid, ref: 'users' },   message: string,   senton:   date, });  var users = mongoose.model('users', userschema); var messages = mongoose.model('messages', messageschema); 

how can query users 'users' collection , last message (single) 'messages' collection?





wiki

Comments

Popular posts from this blog

elasticsearch - what is the equivalent data type for geo_point in hibernate search? -

firebase - How to wait value in Ionic 2 -

Jenkins: find build number for git commit -