MONGODB related Operations

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.