Hello I do not use global variables but if it had a bug, I changed the variables of this block for a name that is only used in this, I'll try it for a few hours and I will comment.
Anyway, for your assistance if someone is in the same situation I found "node-inspector" to debug nodejs code. thank you very much Regards Anto 2014/1/29 Anto <[email protected]> > Hello > > Sorry, delete var to clean several console.log that I had to see the input > parameters and other variables, to let them the cleanest code. These > variables only the use in that part of the code, except the variable doc. > > I'm desperate because I can not find the error. I'll do a dump of mongo > and import it into my computer and work well with real data. Thanks > > Regards > Anto > > > 2014/1/29 Alex Kocharin <[email protected]> > >> >> > identifier = req.params.identifier.toLowerCase(); >> >> If you missed "var" in this case, it would mean that you could have done >> the same thing elsewhere. It would easily be a cause for this. >> >> Maybe dump "global" variable and look for non-standard entries there. >> Almost every one of them would be a bug waiting to show itself (although >> npm source code sometimes proves the opposite...). >> >> >> 29.01.2014, 05:40, "Anto" <[email protected]>: >> >> Hello ! >> >> I summarized part of the code to not dirty list with a lot of text. >> >> I must indicate that I have programmed from scratch twice this part >> avoiding using variable names elsewhere. Console shows me correctly the >> data to be displayed on the web and often works until some time (I have not >> found exactly in which moment fails or pattern to use to replicate the >> fault) shows values of other schemes and no returns to display properly >> until you restart the application. I have not found a pattern, I tried to >> browse the remaining sections, insert data, delete, and always console >> shows me the correct data, but the browser displays other blended. Also in >> my development computer I think it works correctly (I do not work with real >> data), only fail in server, in which I run with forever+nodemon as I can >> not keep an open session. >> >> I tried to let it run with screen + nodemon (I can not leave a session >> open ssh because if loses connection nodejs dies); moment works in a few >> hours able to tell them something (I deleted forever because it is the only >> thing different my computer). >> >> The code is as follows: >> >> - Nodejs + Expressjs >> >> app.get('/brand/:identifier', function(req, res){ >> >> identifier = req.params.identifier.toLowerCase(); >> >> brands.find({ active: true, 'brandName' : { $regex : new >> RegExp(identifier, "i")} }).populate({ >> >> path: 'shop' >> >> ,select: 'name shop description' >> >> }).sort({dateAdded: 'desc'}).exec(function(err, doc) { >> if(doc && doc.length) { >> >> console.log('Data doc: ' + doc); >> >> return res.render('brand_list', { >> shop: doc[0].shop.shop >> ,name: doc[0].shop.name >> ,description: >> doc[0].shop.description >> ,products: doc >> ,pageTitle: >> doc[0].shop.shop >> ,pageUrl: ' >> http://backofficeserver.local/brand/' + identifier >> }); >> >> } else { >> >> return res.render('listado_shop', { >> shop: doc[0].shop.shop >> ,name: doc[0].shop.name >> ,description: >> doc[0].shop.description >> ,error: 'Not product´s >> found' >> ,pageTitle: >> doc[0].shop.shop >> ,pageUrl: ' >> http://backofficeserver.local/brand/' + identifier >> }); >> >> } >> }); >> >> }); >> >> - Jade (resumed) >> >> if error >> h4= error >> else >> h4= 'List of products' >> if products >> each product in products >> li.product(id=product.identifier, name=product.identifier) >> a(href='/show/' + product.identifier, target='_blank') >> >> They know of any tools to debug node js code? Thanks. >> >> Regards >> Anto >> >> >> 2014/1/28 Ryan Schmidt <[email protected]> >> >> Presumably you are storing some information in a variable that is not >> associated with the request, and is therefore shared among all requests. >> The code you posted doesn't seem to have such a problem, so I'd look >> elsewhere in your code. >> >> -- >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> 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 post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "nodejs" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/nodejs/2SxmvchhHaM/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> -- >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> 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 post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> --- >> 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]. >> >> For more options, visit https://groups.google.com/groups/opt_out. >> >> -- >> -- >> Job Board: http://jobs.nodejs.org/ >> Posting guidelines: >> 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 post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/nodejs?hl=en?hl=en >> >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "nodejs" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/nodejs/2SxmvchhHaM/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: 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 post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- 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]. For more options, visit https://groups.google.com/groups/opt_out.
