-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadUser.js
30 lines (28 loc) · 840 Bytes
/
readUser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var mongoose = require('mongoose');
var ChatSchema = require('./schemas/user.js');
var Messages = mongoose.model('User', ChatSchema);
exports.read = function(req, res, login){
var appendMessage = {};
if(typeof login != "undefined"){
appendMessage['flightNumber'] = req;
}
var messages = Messages.
find().
where('email_id').equals('[email protected]').
limit(1).
sort('-timeStamp').
exec(function(err, message){
appendMessage['pseudo_name'] = message[0].pseudo_name;
res.send(appendMessage);
return appendMessage;
});
}
exports.readall = function(res){
var messages = Messages.
find().
sort('pseudo_name').
exec(function(err, message){
res.send(message);
return message;
});
}