顯示具有 mongodb 標籤的文章。 顯示所有文章
顯示具有 mongodb 標籤的文章。 顯示所有文章

2014年7月3日 星期四

[linux][mongodb] install mongodb on centos / mongod: symbol lookup error: mongod: undefined symbol:


install mongodb on centos 6.3 時 ,
發生

mongod: symbol lookup error: mongod: undefined symbol:

看了 log 沒有其他的相關訊息。
使用 官方的 mongodb-org

yum install -y mongodb-org

Install MongoDB on Red Hat Enterprise, CentOS, Fedora, or Amazon Linux — MongoDB Manual 2.6.3
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/

2014年4月15日 星期二

[mongodb]remove record if the field not exists 移除沒有某欄位的資料



想要移除某些沒有包含特定欄位的資料

ex 移除不包含 visted 欄位的資料

db.post.remove({"visted":{"$exists":false}});

java - How can I check whether a field exists or not in MongoDB? - Stack Overflow
http://stackoverflow.com/questions/10057651/how-can-i-check-whether-a-field-exists-or-not-in-mongodb

[mongodb] mongodump / mongorestore backup


使用 mongodb 提供的 tools 來 備份還原 mongodb file
mongodump 會直接 dump 出 bson的 file 
mongorestore 可以還原到 mongodb

  • dump bson 

mongodump -u user -p password --port port -h host -d dbname -c collection_name -o output_dir

ex
mongodump -u admin -p password --port 64631 -h 127.0.0.1 -d python -c post -o post


  • restore from bson file
mongorestore -u user -p password -h host:port -d dbname -c collection_name bsonfile

ex:
mongorestore -u admin -p password -h 127.0.0.1:40816 -d python -c post post2/python/post.bson

[mongodb]mongodb temp


> db.post.runCommand("compact")
{
"errmsg" : "exception: Can't take a write lock while out of disk space",
"code" : 14031,
"ok" : 0
}

MongoDB "Can't take a write lock while out of disk space"
http://jorshasaur.us/mongodb-cant-take-a-write-lock-while-out-of-disk-space/