《PHP實(shí)例:php操作mongoDB實(shí)例分析》要點(diǎn):
本文介紹了PHP實(shí)例:php操作mongoDB實(shí)例分析,希望對您有用。如果有疑問,可以聯(lián)系我們。
本文實(shí)例講述了php操作mongoDB的辦法.分享給大家供大家參考.具體分析如下:PHP學(xué)習(xí)
mongoDB數(shù)據(jù)庫是一種以json格式存儲的數(shù)據(jù)庫,非常適用于各種應(yīng)用開發(fā),這里就來給各位朋友介紹一些mongoDB學(xué)習(xí)實(shí)例.PHP學(xué)習(xí)
mongodb想要整合PHP,需要安裝Mongo擴(kuò)展,這個比較簡單,現(xiàn)在說一下MongoDB PHPAPI? 及用法.PHP學(xué)習(xí)
先看一個簡單的例子,實(shí)例代碼如下:
PHP學(xué)習(xí)
列出所有可用數(shù)據(jù)庫,Php代碼如下:
PHP學(xué)習(xí)
好了就先寫這么多了,有興趣的話可以在網(wǎng)上搜到其他的關(guān)于Mongo-php API的用法.PHP學(xué)習(xí)
命令行使用實(shí)例:PHP學(xué)習(xí)
1. db.system.users.find()
?
2. db.users.count()
?
3. db.users.ensureIndex({password:-1})
?
4. use test
?
5. db.users.getIndexes()
?
6. db.repairDatabase()
?
7. show users
?
8. show dbs
?
9. db.users.find({username:{$in:['4d81a82398790']}}).explain()
?
10. db.users.dropIndexes()
?
11. db.users.find().count()
?
12. db.users.find().limit(5)
?
13. db.users.find({"username":"ssa"})?
?
14. show collections
?
15. db.users.remove()
?
16. db.user.remove({'username':'admin'})
?
17. db.user.insert({'username':'admin','age':21,'nickname':'admin'})
?
18. db.user.save({'username':'admin','age':21,'info':['12','12313','zzsd']})
?
19. db.createCollection("user")?
?
20. db.dropDatabase()
?
21. show collections
?
22. db.test.drop()
?
23. db.copyDatabase('test','test1')
?
24. show profile
?
25. db.printCollectionStats()
?
26. db.addUser('admin','admin123')?
?
27. db.setProfilingLevel(2);
?
28. db.setProfilingLevel( 1 , 10 );
?
29. db.system.profile.find()PHP學(xué)習(xí)
希望本文所述對大家的php程序設(shè)計(jì)有所贊助.PHP學(xué)習(xí)
《PHP實(shí)例:php操作mongoDB實(shí)例分析》是否對您有啟發(fā),歡迎查看更多與《PHP實(shí)例:php操作mongoDB實(shí)例分析》相關(guān)教程,學(xué)精學(xué)透。維易PHP學(xué)院為您提供精彩教程。
轉(zhuǎn)載請注明本頁網(wǎng)址:
http://www.fzlkiss.com/jiaocheng/13150.html