First, I would like to thank cnblogsTV, the blogger TV, and friends who shared their support for the previous period. With your support, I was motivated to write down this issue. You may watch TV on the TV at night, or watch movies on the Internet. After sticking to my computer for a day, I continued to sit at the computer side and listened to 87.6 of Beijing Broadcasting Network, which said technology sharing. Good
First, I would like to thank cnblogs TV, the blogger TV, and friends who shared their support for the previous period. With your support, I was motivated to write down this issue. You may watch TV on the TV at night, or watch movies on the Internet. After sticking to my computer for a day, I continued to sit at the computer side and listened to 87.6 of Beijing Broadcasting Network, which said technology sharing. Good
First, I would like to thank cnblogs TV, the blogger TV, and friends who shared their support for the previous period. With your support, I was motivated to write down this issue. You may watch TV on the TV at night, or watch movies on the Internet. After sticking to my computer for a day, I continued to sit at the computer side and listened to 87.6 of Beijing Broadcasting Network, which said technology sharing. Now, the point is very important. let's talk about our mongodb.
Mongodb can also provide almost all functions that mysql and sqlserver can do.
I. Operators
Operators are certainly known to all. they are equal to, greater than, less than, not equal to, greater than or equal to, and less than or equal to. However, they cannot be used directly in mongodb. The operators in mongodb are represented as follows:
(1) $ gt> (greater)
(2) $ lt <(less)
(3) $ gte >=( greater than or equal)
(4) $ lt <= (less than or equal)
(5) $ ne! = (Not equal)
(6) $ in (inclusive)
(7) $ nin not in (not included)
(8) $ exists exist (whether the field exists)
(9) $ inc adds value to a numeric field
(10) $ set is equivalent to SQL's set field = value.
(11) $ unset indicates deleting a field.
(12) $ push append the value to the field. The field must be of the array type. if the field does not exist, an array type will be added to the U.S. space.
(13) $ pushAll is the same as $ push, but multiple values can be appended to an array field at a time.
(14) $ addToSet adds a value to the array and increases only when the value is not in the array.
(15) $ pop delete the last value: {$ pop: {field: 1} delete the first value: {$ pop: {field:-1}. note, only one value can be deleted, that is, only 1 or-1, website space can be used, and 2 or-2 cannot be used to delete two. Mongodb 1.1 and later versions are available
(16) $ pull deletes a value equal to the value from the array field
(17) $ pullAll is the same as $ pull. multiple values in the array can be deleted at a time.
(18) the $ operator is his own meaning, which indicates a certain item in the array identified by conditions. This is not enough.
II. adding, modifying, reading, and deleting CURD
Add
Db. collection-> insert ({'name' => 'caleng', 'Email '=> 'admin # admin.com'});, Hong Kong server rent