These are chat archives for Automattic/mongoose

7th
Jan 2018
Kev
@lineus
Jan 07 2018 00:05
in your example you have slug twice in the episode schema
slug: String,
serieTitle: String,
chapterTitle: String,
chapter: Number,
server: String,
serverTwo: String,
imageCap: String,
slug: String,
Ivan Nesteruk
@hushino
Jan 07 2018 00:11
the result is undefined
oh I will continue testing
undefined for each null
Ivan Nesteruk
@hushino
Jan 07 2018 00:20
im drop the database. But, the result is the same
Kev
@lineus
Jan 07 2018 00:28
maybe try this:
replace
            if (!serie) return next()
            res.render('catalog', { serie: serie });
           }
.exec(function (err, serie) {
      if (!serie) return next()
      res.render('catalog', { serie: serie });
    })
   }
sorry, I'm still learning markdown too :)
Ivan Nesteruk
@hushino
Jan 07 2018 00:32
ok
Ivan Nesteruk
@hushino
Jan 07 2018 00:39

throw er; // Unhandled 'error' event
^

ReferenceError: serie is not defined

is the result
mmm I think it's not necessary .exec
Ivan Nesteruk
@hushino
Jan 07 2018 00:44
I'm sure the problem is in .ejs template, but it could be anything.
the database drop all data, ejs only show slug, that's why the rest is null
is a fake void (?
Kev
@lineus
Jan 07 2018 01:01
I'm not sure what you mean.
Ivan Nesteruk
@hushino
Jan 07 2018 01:25
Yeah, it's weird
Kev
@lineus
Jan 07 2018 20:17
@hushino if you are using express-helpers to provide the link_to function, it also provides a function link_to_if that seems like it will ultimately fix your problem docs here