Mongo is an open source, free, document-oriented, cross-platform database. Is divided into NoSQL database, in Mongo data is organized in JSON format. \
I met Mongo
\
Mongo is similar to Mysql. After being downloaded and installed, Mongo can be used by third-party GUI visual management tools. Mongobooster, which is usually used, is good and easy to download and install. Here’s an example:
There is data in JSON format
\
Mongobooster provides a more user-friendly interface after storing it in Mongo:
\
Mongo common query
Find Finds the documents that match the criteria
\
db.person.find({‘result.name’ : ‘abccc’})
Find the document whose result.name value is equal to ABCCC. In MongoBooster, results can be displayed in Json, documents and table.
\
The in operation checks whether the value is null
\
db.person.find({‘result.name’:{$in:[null]}})
db.person.find({‘result.aff.desc’:{$in:[null], $exists:true}})
Use the symbol ‘.’ to query for fields in the subdocument. The first line of code queries for documents under the result subdocument where the name field is missing. The second line of code returns the document in which the desc field of the result subdocument AFF exists, but the value is empty
\
The ne operation determines that the field value does not equal ***
\
db.Address.find({‘country’:{$ne:’China’}}).count()
The above code is used to determine the number of docs whose country value is not equal to China
\
The return value does not contain the ‘_id’ value
\
The return value of mongo generally returns the id information by default. To specify that id information is not returned, the following code can be used to output the parse_location field instead of the _id field:
Db. Merge_4. Find ({‘ parse_location: / state /}, {‘ parse_location: 1, “_id” : 0})
\
Return a unique value
\
Db. Merge_4. Distinct (‘ parse_location ‘{‘ parse_location: / state /})
\
Welcome to follow the wechat public account “Data Analyst Notes”
\