Hello , I wanted to ask if for these statements in mongo:

 collection.find({},{}).toArray(function(err, result) {

 collection.find({email : req.user.email},{}).toArray(function(err, result) {

the equivalents in postgresql are:

    client.query( "SELECT * FROM theTable ", function(err,result) {

    client.query( "SELECT * FROM theTable WHERE email = 'req.user.email'  ", function(err, result) {

result should be automatically an array in postgresql?( for the second statement )

And regarding this ?

collection.count({email:'user@mail.com'}, function(error, c) {

How can I write it in postgresql?

Like this?

        client.query("SELECT  COUNT(*) FROM theTable WHERE email = 'user@mail.com' ", function(err, c) {

And the result c will work as in the mongo?It will hold the counts?

Thanks!

Any ideas?
Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.