It does not require mongoose. You can use the native mongodb driver
installed with `npm install mongodb` and require it with `mongodb =
require('mongodb')`.
It does not requires a user being declared. You could have put your
method right away but that's kind of messy. Something like:
app.get('/users', function (req, res, next) {
// Your operations go here
});
As you can see that's pure JavaScript and user was supposed to be an
Object with the methods for users-related actions.
On 4/8/14, 10:43 PM, Frank Z wrote:
> Can someone actually help me? YES, I am VERY GOOD at JavaScript.
>
> Here's the deal, I'm NEW TO BACK END!!!!!!!!!!!!!!!!!!
>
> I'm better with very direct and lower level stuff like, you know, actual
> programming, making variables and loops and what not.. This is all
> layers of abstractions upon abstractions, Dependencies piled on top of
> dependencies...
>
> Why does mongoDB require mongoose? Why does it need a user declared? How
> to I get Mongo to talk to Express.js? This exceed the boundaries of
> JavaScript as a programming language.
>
>
> On Tue, Apr 8, 2014 at 11:39 PM, Luiz Filipe <[email protected]
> <mailto:[email protected]>> wrote:
>
> Focus guys this list is destined to share knowledge about nodejs.
>
> Em 09/04/2014 00:36, "Frank Z" <[email protected]
> <mailto:[email protected]>> escreveu:
>
> By the way... What is your deal exactly? What makes you assume
> that I don't know JavaScript? I'm guessing you're bitter because
> you're still a virgin? I understand bro, it's cool.
>
> You are better at JavaScript at least, so good for you.
>
> On Tuesday, April 8, 2014 8:26:04 PM UTC-4, Martín Ciparelli wrote:
>
> You don't know Javascript and because of that mongodb is
> confusing?
> Inline image 1
>
>
> On Tue, Apr 8, 2014 at 9:20 PM, Jose Luis Rivas
> <[email protected]> wrote:
>
> Where's "user"?
>
> You have to write and declare "user" before using it. It
> has nothing to
> do with mongodb, at all.
>
> You have to write the method "list" inside user too
> before trying to tie
> something to that method.
>
> On 4/8/14, 7:10 PM, Frank Z wrote:
> > I installed mongodb through my unbuntu terminal after
> installing node.js.
> >
> > When I run |sudo| |service mongodb start|
> > |
> > |
> > |I get back "|start: Job is already running: mongodb"
> from the terminal
> >
> > So my assumption is that everything is running
> properly here...
> >
> > I'm trying to make this todo list from an example in
> my book, using
> > express.js. I used the package.json file to install
> the depenencies:
> >
> > {
> > "name": "application-name",
> > "version": "0.0.1",
> > "private": true,
> > "scripts": {
> > "start": "node app.js"
> > },
> > "dependencies": {
> > "express": "3.5.1",
> > "jade": "*",
> > "mongoose":"3.8.4"
> > }
> > }
> >
> > Then I run npm install in my terminal...
> >
> > Everything is correct in my app.js file, all the
> variables declared
> > properly with mongoose and everything...
> >
> > I run node app.js and get back:
> >
> >
>
> /home/frankz/Desktop/__nodesandbox/connect_to_mongo/__app.js:40
> > app.get('/users', user.list);
> > ^
> > ReferenceError: user is not defined
> > at Object.<anonymous>
> >
>
> (/home/frankz/Desktop/__nodesandbox/connect_to_mongo/__app.js:40:19)
> > at Module._compile (module.js:456:26)
> > at Object.Module._extensions..js (module.js:474:10)
> > at Module.load (module.js:356:32)
> > at Function.Module._load (module.js:312:12)
> > at Function.Module.runMain (module.js:497:10)
> > at startup (node.js:119:16)
> > at node.js:902:3
> >
> > So what's going on here?
> >
> > --
> > --
> > Job Board: http://jobs.nodejs.org/
> > Posting guidelines:
> >
>
> https://github.com/joyent/__node/wiki/Mailing-List-__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
> > nodejs+un...@__googlegroups.com
> > For more options, visit this group at
> > http://groups.google.com/__group/nodejs?hl=en?hl=en
> <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 nodejs+un...@__googlegroups.com
> > <mailto:nodejs+un...@__googlegroups.com>.
> > For more options, visit
> https://groups.google.com/d/__optout
> <https://groups.google.com/d/optout>.
>
> --
> Jose Luis Rivas - http://joseluisrivas.net
> Venezuela - GPG: 0xB9AC8C43
>
> --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
>
> https://github.com/joyent/__node/wiki/Mailing-List-__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
> nodejs+un...@__googlegroups.com
> For more options, visit this group at
> http://groups.google.com/__group/nodejs?hl=en?hl=en
> <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 nodejs+un...@__googlegroups.com.
> For more options, visit
> https://groups.google.com/d/__optout
> <https://groups.google.com/d/optout>.
>
>
> --
> --
> 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]
> <mailto:[email protected]>
> To unsubscribe from this group, send email to
> [email protected]
> <mailto:nodejs%[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]
> <mailto:[email protected]>.
>
> For more options, visit https://groups.google.com/d/optout.
>
> --
> --
> 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]
> <mailto:[email protected]>
> To unsubscribe from this group, send email to
> [email protected]
> <mailto:nodejs%[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/XF9mhLAGepQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> --
> 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]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout.
--
Jose Luis Rivas - http://joseluisrivas.net
Venezuela - GPG: 0xB9AC8C43
--
--
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/d/optout.