Instead of converting req.params.id to an ObjectId try just passing in the
string. That seems to be what it is expecting.
Also if this is mongoose and you're querying using the Model object then
you can use findById. Your way isn't wrong and it will work fine but
findById may be more readable.
ProjectSubmit.findById(req.params.id).then((projectSubmit)=>{
res.render('main/proposal-des', {title: req.params.projectName,
projectSubmit: projectSubmit});
}, (e) => {
res.status(404).send(e);
});
On Wednesday, November 29, 2017 at 4:36:38 PM UTC-5, Md Ashiqur Rahman
wrote:
>
> how to resolve this error:- Argument passed in must be a single String of
> 12 bytes or a string of 24 hex characters.
>
> ProjectSubmit.findOne({'_id': ObjectId.createFromHexString(req.params.id
> )}).then((projectSubmit)=>{
> res.render('main/proposal-des', {title: req.params.projectName,
> projectSubmit: projectSubmit});
> // res.render('proposalList', { title: 'Synergy Proposal List'});
> }, (e) => {
> res.status(404).send(e);
> });
>
>
> when logout url hit this error occured
>
--
Job board: http://jobs.nodejs.org/
New group rules:
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nodejs/60564280-137e-476f-a9b6-f755e44428ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.