4 年前更新 |MongoDB

今天迁移MongoDB数据库出现了很奇怪的问题,使用的方法如下:

备份方法:
mongodump -h dbhost -d dbname -o dbdirectory
还原方法:
mongorestore -h <hostname><:port> -d dbname <path>
3 年前更新 |MongoDB

So, everytime when I have to start my node apps I often forgot to run my MongoDB service and it is a bit annoying where you have to have one tab dedicated to something you won't touch at all and I thought I should find a way to run this from my startup item on my Mac OS X.

Luckily, this post from Hunter Ford's blog explains how to run your MongoDB in your Startup item on Mac OS X and here is how:

Create a file call org.mongo.mongod.plist in /Library/LaunchDaemons/

If you use vim you can do like this:

sudo vim /Library/LaunchDaemons/org.mongo.mongod.plist
2 年前更新 |MongoDB
1 年前更新 |MongoDB

查出数组长度等于3的记录

db.user.find({ books: { $size: 3} })
1 年前更新 |MongoDB

官方手动安装方法

创建配置文件

执行命令: sudo vim /etc/mongodb/mongod.conf 并添加以下内容

systemLog:
  destination: file
  path: /var/log/mongodb/mongod.log
  logAppend: true
storage:
  dbPath: /var/lib/mongo
net:
  bindIp: 127.0.0.1
1 年前发布 |mongoose, MongoDB
1 / 1
© 2016 - 2021 BY 禾惠 粤ICP备20027042号