I want to retrieve or insert data into mongodb through console. But I can't find a way how to do that. primarily I deployed a application but I don't find a way how to do that through console. Can anyone drive through that ?
I didn't understand what you meant by console but here's how you can use Apigee's API Management platform and the concept of proxies to achieve the same.
You could do this in node.js using the mongodb npm modules. Something like this should work:
varMongoClient=require('mongodb').MongoClient, format =require('util').format; MongoClient.connect('mongodb://127.0.0.1:27017/test',function(err, db){if(err)throw err;var collection = db.collection('test_insert'); collection.insert({a:2},function(err, docs){ collection.count(function(err, count){ console.log(format("count = %s", count));});}); // Locate all the entries using find collection.find().toArray(function(err, results){ console.dir(results);// Let's close the db db.close();});});
You can also use the mongodb-core npm module, more details available here: https://www.npmjs.com/package/mongodb-core
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |