Aria,

Thanks for your response...

I use MongooseJS, i think his no have method GET.

I need  take this variable  for all modules in my app.

Thanks again.

Em terça-feira, 31 de maio de 2016 11:26:44 UTC-3, Aria Stewart escreveu:
>
>
> > On May 31, 2016, at 09:25, Emerson Luiz <elu...@gmail.com <javascript:>> 
> wrote: 
> > 
> > HI, 
> > 
> > I need get some info in my MongoDB and set the results as GLOBAL VARS in 
> node.js. 
> > 
> > Someone has done this before ? 
> > Can show how you done this ? 
>
>
> That probably isn't a thing you really want to do. It'd go something like 
> this: 
>
> myMongoConnection.get('some key', function (err, data) { 
>    if (err) throw new Error("I have no idea how to handle this error 
> because of what we're doing here"); 
>    global.something = data.somethingelse; 
> }) 
>
> But what task are you actually trying to do here? If one module is 
> dependent on another, perhaps have it explicitly depend on it; if this is 
> initialization step to get configuration that everything else needs, 
> perhaps this belongs in a loader that makes a config object and passes it 
> to the things that use it. If it _is_ a config loader, where is the db 
> config coming from? 
>
> Knowing what you're trying to do at a higher level might help guide toward 
> a better design. 
>
> Aria

-- 
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 nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/c068bf39-13d8-4ce0-9881-81d1cf64db1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to