Take the 2-minute tour ×

Here is the code for initialization

var db = mongoose.connection;
db.on('open', function () {
  // now we can start talking

After successful opening, I am saving data like this, it's giving me no errors.

function saveGPSData(data){
  var newData = new GPSData(data);
        return console.error(err);


Now in mongo shell, I am trying to retrieve that data but it's giving me empty output.

> use gpsdb
> db.GPSData.find();

It's giving me no output. Also can I found what models are there in gpsdb?

Here is the full source code http://pastebin.com/K7QPYAx8

JUST FOUND THAT in db folder there these files for my db created by mongodb

share|improve this question
Show more code. –  alessioalex Jan 11 '12 at 16:31
pastebin.com/K7QPYAx8 –  coure2011 Jan 11 '12 at 16:48
Are you using safe writes? By default Mongodb uses fire-and-forget writes which won't report errors. If you're not using safe writes, then its possible that the write is failing silently without reporting an error. Check out mongodb.org/display/DOCS/getLastError+Command for more information. –  stbrody Jan 11 '12 at 19:59
add comment

2 Answers

A good place to start to get a quick answer is


the community is very responsive :)

share|improve this answer
add comment
up vote 0 down vote accepted

In the shell I did the following

>use gpsdb
switched to gpsdb
>db show collections

From here I found that collection name is gpsdatas...... Not sure why its adding extra (s) to my modal, although you can see from the code that I am setting Modal to

var GPSData = mongoose.model('GPSData', GPSDataSchema);

Now using the shell its working like this

share|improve this answer
add comment

Your Answer


