PHP之mongodb

mongoDB是一种非关系型数据库;是一种面向文档的数据库(没有表的概念,一条记录就叫一个文档,多个文档放在一起,就叫集合);适合存储数据结构简单,数据量大,数据读写频繁,高并发的操作;没有联表的操作;

member和Redis是非关系型的缓存;

mongoDB使用javascript 操作;关系型数据库用的是sql语句;

MongoDB以json形式保存一条记录,读写方面性能非常快;

MongoDB无模式(不用建立表,直接插入),没有视图,事务,存储过程;扩展容易(分表,分库,读写分离,分布式集群,配置一下即可);

PHP之mongodb

=======mongodb安装:

PHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodb


PHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodbPHP之mongodbPHP之mongodbPHP之mongodb


=========MongoDB的权限设置:

1.账号设置

PHP之mongodb

PHP之mongodb

这样就完城了权限机制;

MongoDB的一个账号只属于一个数据库;

超级管理员可以操作所有的数据库类;超级管理员登陆的时候要切换到addmin数据库,其他的账号登陆要切换到相应的数据库;

PHP之mongodb



==========================PHP操作mongoDB

PHP中必须要安装了mongo扩展才能生效执行;

PHP之mongodbPHP之mongodb

PHP之mongodb

重启apache;

PHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodbPHP之mongodbPHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodbPHP之mongodbPHP之mongodb

PHP之mongodbPHP之mongodb

PHP之mongodbPHP之mongodb

PHP之mongodbPHP之mongodb

PHP之mongodbPHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodb

PHP之mongodb