Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2016
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. const userSchema = new mongoose.Schema({
  2. email: { type: String, unique: true },
  3. password: String,
  4.  
  5. todosDo: [models.Do.schema],
  6. }
  7.  
  8. const doSchema = new mongoose.Schema({
  9. name: {type: String, default : ''},
  10. user: {type: mongoose.Schema.ObjectId, ref: 'User'},
  11. createdAt: {type : Date, default : Date.now}
  12. });
  13.  
  14. // Get all "Do" todos from DB
  15. // Experimenting to find todos from certain user
  16. User.findById(req.user.id, function(err, user){
  17. if(err){
  18. console.log(err);
  19. } else {
  20. doTodos = user.todosDo, // this obviously doesn't work, just an idea of what I was going for
  21. console.log(doTodos);
  22. finished();
  23. }
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement