shell command vs. Mysql
Querying data |
equals: Db.col.find ({"Delete_flag": "N"}). Pretty () Less than: Db.col.find ({"Count": {$lt: Ten}}). Pretty () Less than (lt:less than) Less than or equal (lte:less than or equal) Greater than (gt:greater than) Greater than or equal (gte:greater than or equal) |
where Delete_flag = ' N ' Where Count < 10 |
Update data |
Db.col.update ({' Phone_number ': {$gt: ' 18800000000 '}}, {$set: {' full_name ': ' Dake '}}, |
Update Test Set full_name = ' Dake ' where phone_number = ' 18800000000 ' |
Inserting data |
db.col.insert ({ phone_number: ' 18800000000 ', full_name: ' Dake ', delete_flag: ' N ' }) |
INSERT into Test (Phone_number, Full_name, Delete_flag) VALUES (' 18810160000 ', ' dake ', ' N ') |
Delete data |
Db.col.remove ({' Phone_number ': ' 18800000000 '}) |
Delete from test where phone_number = ' 18800000000 ' |
Applications on PHP 7.0
$manager = new Mongodb\driver\manager ("mongodb://localhost:27017"); $filter = [' full_name ' = [' $eq ' + ' dake ']]; where full_name = ' dake ' $options = []; $query = new Mongodb\driver\query ($filter, $options); $cursor = $manager->execu Tequery (' Test.col ', $query); Echo ' <pre> '; foreach ($cursor as $document) {print_r ($document);}
MONGODB related Operations