Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exports.profileGet = (req, res) => {
- // console.log(req.user._id)
- const id = req.user._id.toString()
- console.log(id)
- User.find({ username: 'p' }).exec((err, user) => {
- if (err) {
- res.render('profile')
- }
- console.log(user)
- })
- Photo.find({ userId: id }).exec((err, results) => {
- if (err) {
- res.render('profile')
- }
- console.log(results)
- })
- 5c89a00e102515541329db1a
- [ { isAdmin: false,
- _id: 5c89a00e102515541329db1a,
- email: 'p',
- username: 'p',
- password:
- '$2b$10$CTihm9TXcbyYFEHZU8GruOT61kyBDTj7wFGg4QaQN6bIMpnKv6oiO',
- __v: 0 } ]
- throw er; // Unhandled 'error' event
- ^
- RangeError: Invalid count value
- at String.repeat (<anonymous>)
- at reduceToSingleString
- (internal/util/inspect.js:1216:27)
- at formatRaw (internal/util/inspect.js:777:15)
- at formatValue (internal/util/inspect.js:539:10)
- at formatProperty (internal/util/inspect.js:1133:11)
- at formatRaw (internal/util/inspect.js:760:9)
- at formatValue (internal/util/inspect.js:539:10)
- at formatValue (internal/util/inspect.js:527:18)
- at formatProperty (internal/util/inspect.js:1133:11)
- at formatArray (internal/util/inspect.js:958:17)
- at formatRaw (internal/util/inspect.js:757:14)
- at formatValue (internal/util/inspect.js:539:10)
- at inspect (internal/util/inspect.js:196:10)
- at Object.formatWithOptions (util.js:84:12)
- at Console.(anonymous function)
- (internal/console/constructor.js:274:15)
- at Console.log (internal/console/constructor.js:283:59)
- Emitted 'error' event at:
- at /Users/samuelchasan/Documents/ITP/thesis_app/node_modules/mongoose/lib/model.js:4700:13
- at /Users/samuelchasan/Documents/ITP/thesis_app/node_modules/mongoose/lib/utils.js:263:16
- at _hooks.execPost (/Users/samuelchasan/Documents/ITP/thesis_app/node_modules/mongoose/lib/query.js:4074:11)
- at /Users/samuelchasan/Documents/ITP/thesis_app/node_modules/kareem/index.js:135:16
- at processTicksAndRejections (internal/process/next_tick.js:74:9)
- const mongoose = require('mongoose');
- const Schema = mongoose.Schema;
- const photoSchema = new Schema({
- name: { type: String },
- data: { type: Buffer },
- contentType: { type: String },
- userId: { type: String }
- });
- module.exports = mongoose.model('photos', photoSchema);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement