Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. exports.profileGet = (req, res) => {
  2. // console.log(req.user._id)
  3. const id = req.user._id.toString()
  4. console.log(id)
  5.  
  6. User.find({ username: 'p' }).exec((err, user) => {
  7. if (err) {
  8. res.render('profile')
  9. }
  10. console.log(user)
  11. })
  12.  
  13. Photo.find({ userId: id }).exec((err, results) => {
  14. if (err) {
  15. res.render('profile')
  16. }
  17. console.log(results)
  18. })
  19.  
  20. 5c89a00e102515541329db1a
  21.  
  22. [ { isAdmin: false,
  23. _id: 5c89a00e102515541329db1a,
  24. email: 'p',
  25. username: 'p',
  26. password:
  27. '$2b$10$CTihm9TXcbyYFEHZU8GruOT61kyBDTj7wFGg4QaQN6bIMpnKv6oiO',
  28. __v: 0 } ]
  29.  
  30. throw er; // Unhandled 'error' event
  31. ^
  32.  
  33. RangeError: Invalid count value
  34. at String.repeat (<anonymous>)
  35. at reduceToSingleString
  36. (internal/util/inspect.js:1216:27)
  37. at formatRaw (internal/util/inspect.js:777:15)
  38. at formatValue (internal/util/inspect.js:539:10)
  39. at formatProperty (internal/util/inspect.js:1133:11)
  40. at formatRaw (internal/util/inspect.js:760:9)
  41. at formatValue (internal/util/inspect.js:539:10)
  42. at formatValue (internal/util/inspect.js:527:18)
  43. at formatProperty (internal/util/inspect.js:1133:11)
  44. at formatArray (internal/util/inspect.js:958:17)
  45. at formatRaw (internal/util/inspect.js:757:14)
  46. at formatValue (internal/util/inspect.js:539:10)
  47. at inspect (internal/util/inspect.js:196:10)
  48. at Object.formatWithOptions (util.js:84:12)
  49. at Console.(anonymous function)
  50. (internal/console/constructor.js:274:15)
  51. at Console.log (internal/console/constructor.js:283:59)
  52. Emitted 'error' event at:
  53. at /Users/samuelchasan/Documents/ITP/thesis_app/node_modules/mongoose/lib/model.js:4700:13
  54. at /Users/samuelchasan/Documents/ITP/thesis_app/node_modules/mongoose/lib/utils.js:263:16
  55. at _hooks.execPost (/Users/samuelchasan/Documents/ITP/thesis_app/node_modules/mongoose/lib/query.js:4074:11)
  56. at /Users/samuelchasan/Documents/ITP/thesis_app/node_modules/kareem/index.js:135:16
  57. at processTicksAndRejections (internal/process/next_tick.js:74:9)
  58.  
  59. const mongoose = require('mongoose');
  60. const Schema = mongoose.Schema;
  61. const photoSchema = new Schema({
  62. name: { type: String },
  63. data: { type: Buffer },
  64. contentType: { type: String },
  65. userId: { type: String }
  66. });
  67.  
  68. module.exports = mongoose.model('photos', photoSchema);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement