posts - 495,  comments - 11,  trackbacks - 0

          1.進入mongodb命令行管理
          C:\Documents and Settings\Administrator>mongo
          MongoDB shell version: 1.8.1
          connecting to: test

          ?

          2.顯示數(shù)據(jù)庫
          > show dbs
          admin?? (empty)
          local?? (empty)
          test_db 0.03125GB

          ?

          3.使用數(shù)據(jù)庫
          > use test_db
          switched to db test_db

          ?

          4.添加數(shù)據(jù)庫用戶
          > db.users.save({username:"gerald"})

          ?

          5.查找數(shù)據(jù)庫用戶
          > db.users.find()
          { "_id" : ObjectId("4ddf396e641b4986d346fe89"), "username" : "gerald" }

          ?

          6.添加隸屬于某個數(shù)據(jù)庫的用戶
          > use test_db
          switched to db test_db
          > db.addUser("gerald","123456")
          {
          ??????? "user" : "gerald",
          ??????? "readOnly" : false,
          ??????? "pwd" : "f528f606b8635241c7f060408973b5b9"
          }

          ?

          7.以用戶驗證的身份登錄數(shù)據(jù)庫
          > use test_db
          switched to db test_db
          > db.auth("gerald","123456")
          1

          PS: 1代表驗證成功, 0代表驗證失敗

          ?

          關(guān)鍵詞:數(shù)據(jù)庫? NoSQL? MongoDB? Database

          ?

          posted on 2011-05-27 15:38 jadmin 閱讀(112) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 靖宇县| 崇义县| 金湖县| 和林格尔县| 宣汉县| 平乐县| 哈巴河县| 达孜县| 元江| 托里县| 钟山县| 卢湾区| 永泰县| 定安县| 长寿区| 含山县| 宜春市| 游戏| 太白县| 白银市| 新晃| 西林县| 来安县| 隆化县| 常德市| 大同市| 腾冲县| 闸北区| 无棣县| 新和县| 富锦市| 天全县| 九龙城区| 盖州市| 九江市| 黄梅县| 广水市| 洪湖市| 曲阜市| 六安市| 依安县|