In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
MongoDB which query syntax, many novices are not very clear, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
1. Inquiry
Find method
Db.collection_name.find ()
Query all the results:
Select * from users
Db.users.find ()
Specify which columns (keys) are returned:
Select name, skills from users
Db.users.find ({}, {'name': 1,' skills': 1})
Supplementary note: the first {} puts the where condition and the second {} specifies which columns are displayed and not displayed (0 means not displayed 1 means displayed)
Where condition:
1. It simply equals:
Select name, age, skills from users where name = 'hurry'
Db.users.find ({'name':' hurry'}, {'name': 1,' age': 1, 'skills': 1})
two。 Use and
Select name, age, skills from users where name = 'hurry' and age = 18
Db.users.find ({'name':' hurry', 'age': 18}, {' name': 1, 'age': 1,' skills': 1})
3. Use or
Select name, age, skills from users where name = 'hurry' or age = 18
Db.users.find ({'$or': [{'name':' hurry'}, {'age': 18}]}, {' name': 1, 'age': 1,' skills': 1})
4. = ($lt, $lte, $gt, $gte)
Select * from users where age > = 20 and age
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.