【MongoDB】Serveral common command of MongoDb,mongodbserveral

來源:互聯網
上載者:User

【MongoDB】Serveral common command of MongoDb,mongodbserveral

In the recent days, since the overwork made me exhaused, on arrival to home I will go to bed, which leads to loss of blogs that should have been written in the past days. 

Now  I make a summay to all the commond of operating mongoDB.

First, you should run the mongoDB server. if the following picture exists, it means you has run the mongoDB successfully. 


Secondly,after run the mongodb server, next should execute the mongodb client. 


thirdly, we input the db.help command, we will find all the method to operate database/


In the above picture, it;s generally used in the development.

Notes, in the mongodb, there is no command like mysql ('create database xxx'), instead use command 'use dbname' to create a new db;

Lastly I set a simple exampe to show usage of some command.







mongodb啟動服務時報錯錯誤1067,進程意外終止

我之前也遇到過類似的問題,個人分析是資料的問題,在網上查資訊說要刪掉mongod.lock檔案就重啟就可以了,但是在我的機子上依然出現上述問題。
如果之前一直好好的,僅僅是因為插入了資料導致服務無法使用,處理問題的方法就很簡單了,把你剛剛複製的資料和mongod.lock檔案刪掉(都在data檔案夾下)。有可能是因為mongodb-win32-i386-2.2.1這個版本的某個檔案夾下有你剛剛複製進去的資料,資料的重複導致只刪掉mongod.lock無法啟動。
註:mongodb在mongodb-win32-i386-2.2.1這版本的時候,資料存放區在data檔案夾會自己建立檔案夾(之前是直接以.ns .0 .1的格式儲存在data檔案夾下)。
這是我的自己嘗試出來的方法。具體原因我也分析不出來,希望能幫到你。
 
mongodb不可以啟動,由於目標電腦積極拒絕,不可以串連

這不是mongodb無法啟動,是你還沒有啟動mongodb就來串連使用它了,肯定是不成功的。
先去mongodb的bin目錄下運行mongod --dbpath XXXX/data 來啟動mongodb,然後再來串連mongodb。
 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.