Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const userSchema = new mongoose.Schema({
- email: { type: String, unique: true },
- password: String,
- todosDo: [models.Do.schema],
- }
- const doSchema = new mongoose.Schema({
- name: {type: String, default : ''},
- user: {type: mongoose.Schema.ObjectId, ref: 'User'},
- createdAt: {type : Date, default : Date.now}
- });
- // Get all "Do" todos from DB
- // Experimenting to find todos from certain user
- User.findById(req.user.id, function(err, user){
- if(err){
- console.log(err);
- } else {
- doTodos = user.todosDo, // this obviously doesn't work, just an idea of what I was going for
- console.log(doTodos);
- finished();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement