MongoDB does not support multiple table queries ?
1. Running MONGO Service
Open cmd and enter e: Enter e-drive.
Enter the CD E:\mongdb\bin into the directory.
Enter the Mongod--dbpath E:\mongodb\data//Turn on the MONGO service and save the data in the Information folder.
? do not close cmd, close the MONGO service. ?
2. Operation Grammar
Connecting to a database
<?php$conn = new Mongo ();//Instance $db = $conn->mongo//Select database $coll= $db->user//Select table
Insert
$coll->insert (Array (' ID ' =>48)),//insert int type 48, query for direct ' ID ' =>48$coll->insert (array (' id ' = ' 48 '))// Insert the character type of 48, the time of the query ' id ' = ' 48 '
Delete
$coll->remove ();//delete from User$coll->remove (array (' ID ' =>1));//delete from user where id=1
select
$coll->find ();// select * from user $coll->findone ();//select top 1 * from user$coll->find (Array (' ID ' =>1), array (' ID ' =>1, ' name ' =>1);//select id, Name from user where id=1$coll->find (Array (' Name ' =>new mongoregex ('/a/'));// select * from user where name like '%a% ' $coll->find (Array (' name ' = >new mongoregex ('/^a/'));//select * from user where name like ' a% ' $coll->find (array (' ID ' =>array (' $gt ' =>3))->sort (array (' ID ' =>1))//select *from user where id>3 order by id asc $GT is greater than, $lt is less than, Desc is sort (array (' ID ' =>-1)) $coll->count ();//select count (*) from user$coll->find ( Array (' $or ' =>array (' id ' =>1;), Array (' name ' = ' B ') ')//select * from user where Id=1 or name= 'B ' $coll->find ()->limit (5)->skip (0)->sort (array (' ID ' =>1))//select * from user order by id asc limit 0,5; $db->command (Array (' distinct ' = ' user ', ' key ' = > ' name ')//select distinct * from user
Update
$coll->update (Array ("id" =>3), Array (' $set ' =>array (' id ' =>1));//update user set id=1 where id=3; $coll- >update (Array ("id" =>3), Array (' $inc ' =>array (' id ' =>2));//update user set id=id+2 where id=3;