Iam trying to save/insert in MongoDB
using express and mongoJS
My Code :
var port = 8580;
var express = require ('express');
var app = express ();
// import mongojs Modul
var mongojs = require("mongojs");
//connect
var db = mongojs.connect("localhost:27017/hexx",["users", "reports"]);
//unser Pfad
app.get('/', function(req,res){
db.users.insert({email: "srirangan@gmail.com", password: "iLoveddMonfxxgodd", sex: "male"});
console.log("HTTP server running at Port// :" + port);
db.users.save({created:'just now'});
console.log(db.users);
});
app.listen(port);
When I go to Mongo-Console to "show databases" it will show the new created Database
and when I use in console "db.hexx.users.find()" its empty and when I insert per console "db.hexx.users.insert({email: "srirangan@gmail.com", password: "iLoveddMonfxxgodd", sex: "male"})" - it inserts
In nodeJs its not working
db.users.insert({email: "srirangan@gmail.com", password: "iLoveddMonfxxgodd", sex: "male"});
Thanks