0

I've installed MongoDB v3.0.6 on my Windows 7 machine and I'm trying to start the database.

I have one command line window with the node app running and second command line window in which I navigated to 'D:/mongodb/bin' and used:

mongodb.exe --dbpath d:/mongodb/data

Which listens for connections, so I opened a third command line window and tried this:

mongodb.exe

Which gives me: I CONTROL Hotfix KB2731284 or later update is not installed, will zero out data files MongoDB shell version 3.0.6 connecting to: test

Then when I run the app in the browser it crashes and I get a red 'app crashed - blah blah blah' in the command line window that's running the node app.

I have this in my app.js file:

var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/emedb');
var Schema = mongoose.Schema;

// create a schema
var userSchema = new Schema({
  name: String,
  username: {
    type: String,
    required: true,
    unique: true
  },
  password: {
    type: String,
    required: true
  },
  admin: Boolean,
  location: String,
  meta: {
    age: Number,
    locale: String
  },
  created_at: Date,
  updated_at: Date
});

// on every save, add the date
userSchema.pre('save', function(next) {
  // get the current date
  var currentDate = new Date();

  // change the updated_at field to current date
  this.updated_at = currentDate;

  // if created_at doesn't exist, add to that field
  if (!this.created_at)
    this.created_at = currentDate;
  next();
});

// the schema is useless so far
// we need to create a model using it
var User = mongoose.model('User', userSchema);

// make this available to our users in our Node applications
module.exports = User;

Which I suspect is where my problem is. As many could probably guess I'm very new to this. It's my first attempt at using MongoDB. What's wrong?

Gaurav Gandhi
  • 3,041
  • 2
  • 27
  • 40
tdrsam
  • 527
  • 1
  • 8
  • 28
  • [For the hotfix](http://stackoverflow.com/questions/30501440/mongodb-hotfix-kb2731284). The *blah blah blah* part is the interesting part of the error and should tell you exactly what's going on. – Shanoor Feb 05 '16 at 04:30
  • Try running mongod.exe without the b. – Moshe Karmel Feb 05 '16 at 04:39
  • I think it's working. If you - @Moshe Karmel - want to put your comment as an answer, I'll check it again next week and set it as the correct answer if it's still working. – tdrsam Feb 05 '16 at 04:45
  • I was wondering if someone would want to know the blah, blah, blah part. @ShanShan it's 'waiting for file changes before starting' – tdrsam Feb 05 '16 at 04:47

1 Answers1

1

Try running mongod.exe without the b

https://docs.mongodb.org/manual/reference/program/mongod/#bin.mongod

Moshe Karmel
  • 459
  • 4
  • 9