This time I will bring you a detailed explanation of the steps for adding, deleting, modifying, and querying MongoDB in php7. What are the precautions for adding, deleting, modifying, and querying in MongoDB using php7? The following is a practical case, let’s take a look.
MongoDB's PHP driver provides some core classes to operate MongoDB. Generally speaking, it can implement all the functions in the MongoDB command line, and the parameter formats are basically similar. Versions before PHP7 and versions after PHP7 have different operations on MongoDB. This article mainly uses the previous version of PHP7 as an example to explain the various operations of PHP on MongoDB. Finally, it briefly explains the operation of MongoDB by versions after PHP7.1. Data insertion
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
2. Data query
1. Query a single document:1 2 3 4 5 6 7 8 9 |
|
1 2 3 4 5 6 7 8 9 10 11 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
1 2 3 4 5 6 7 8 9 10 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
3. Data modification
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
4. Data deletion
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
PHP7 operation method
Data insertion:
1 2 3 4 5 6 7 8 |
|
Data query:
1 |
|
Data modification:
1 2 3 4 5 6 7 8 9 10 |
|
Data Delete:
1 2 3 4 5 6 7 8 |
|
Laravel 5.4 Detailed explanation of vue vux element environment matching steps
The above is the detailed content of Detailed explanation of the steps to add, delete, modify and query MongoDB using php7. For more information, please follow other related articles on the PHP Chinese website!