0

ExtJs Code:

tab.getStore().getProxy().setExtraParam("CCP", filterDetails );
                tab.getStore().load();

Node.js Code:

exports.loadGrid = function(req, res){
    var filteredDetails = req.param('CCP');
    console.log(filteredDetails );
    mongoClient.connect(config.database.path, function(err, db) {
        if(err) throw err;
        var collection = db.collection('trades');
        // Locate all the entries using find
        if(filteredDetails != null)
        {
            collection.find({$and:[ filteredDetails ]}).toArray(function(err, results) {
                console.log(results);
                res.send(results);
                db.close();
            });
        }
        else
        {
            collection.find().toArray(function(err, results) {
                console.log(results);
                res.send(results);
                db.close();
            });
        }
    })
};

Here is my result:

[ '[object Object]', '[object Object]' ]

This is the log printed in the console for the code[console.log(filteredDetails );]. Here i want values instead of object.

2
  • 1
    Try console.log( JSON.stringify( results ) ) and similarly in your send Commented May 22, 2014 at 5:53
  • JSON.stringify is part of ECMAScript standard. Thus you don't need to "require" it. And you can also find it in MongoDB shell. Commented May 22, 2014 at 6:10

1 Answer 1

1

You might also try util.inspect to inspect your array of objects.

var util = require('util');

console.log(util.inspect(filteredDetails, { showHidden: true, depth: null }));

Util is one of node's core modules. You can find more information on it here: http://nodejs.org/api/util.html#util_util_inspect_object_options

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.