20160718

windows 下安装让mongodb以windows服务启动,在mongo的bin目录下执行:

mongod --dbpath "d:\mongodb\data\db" --logpath "d:\mongodb\data\log\MongoDB.log" --install --serviceName "MongoDB"

启动mongodb服务:net start MongoDB

关闭mongodb服务:net stop MongoDB

基本的操作命令:

  • mongo
  • show dbs
  • use dbname
  • show collections
  • db.colname.save({key:value})
  • db colname.insert
  • db.coldbname.find()
  • db.coldbname.findOne()
  • db.coldbname.update
  • db.colname.remove
  • db.colname.drop()
  • ad.cloname.find().skip(5).limit(5)