MongoDB Common Operations
First, we start MongoDB:
[Root@h3/]# mongod-f/etc/mongod.conf Wed June 23:38:58.195 Wed June 23:38:58.195 warning:32-bit do
N ' t have journaling enabled by default. Please use the--journal if you want durability.
Wed June
MongoDB as a non relational database (NOSQL), it can be composed of the following structure, documents, collections, databases.
The basic unit of MongoDB is the document, which is similar to a row in a relational database, but from the bottom up,
MongoDB Gridfs File System
Practical Exercises
1. View the mongofile help document with the –help option
2. Put {FileName} through mongofile-h {Ip:port}-d {CollectionName}
where the-h option specifies the host name and the port number, the-d
MongoDB No-mode benefits
1, storage form, compared to the traditional relational database, it can use a table to store the original need to use a multiple table association to store the database. 2, storage dynamic, compared to the traditional
double[] loc = new double[2];//coordinates [longitude, latitude]
loc[0] = 114d;//longitude
loc[1] = 118d;//
latitude DBObject near = new Basicdbobject ();
Near.put ("$near", loc);//indicates near query, unit is "degree"
near.put ("$maxDistance", );//
Classes that are @entity annotations must have a unique @Id value, which is stored in the id attribute of the MongoDB database, which is a required index. Like in the Hotel class:
@Entity
public class hotel{
@Id
Private ObjectId ID;
.....
}
Construct some data with a Python script and then show how to use the
#coding =utf-8 ' Created on 2015-12-28 @author: kwsy ' ' Import pymongo client = Pymongo. Mongoclient ("localhost", 27017) db = client.testaggregate coll = db.teacher t1 = {'
In order to follow up the processing flow of the balance&split of the chunk block separately, this is not covered here. But do not misunderstand that there is no association between the two.
read&write MongoDB give me the feeling is that a bowel
Use command
MongoDB use database_name
Used to create a database. This command will create a new database, and if it does not exist, it will return the existing database.
Dropdatabase () method
MongoDB Db.dropdatabase ()
The command is used to
MongoDB is a non-relational type of database, data storage is very flexible, using a storage structure of Bson, a binary form of class JSON storage format, supporting embedded document objects and array objects, and support some data types that JSON
If you need to uninstall MongoDB, then there are several ways to accomplish this depending on what you want to implement. First, uninstall is just MongoDB
This will delete just the MongoDB package itself.
1
sudo apt-get remove
Indexing is the most effective means of improving query query efficiency. An index is a special data structure that stores portions of the data in an easy-to-traverse format (for example, a specific field or set of field values), which sorts the
1. Differentiate file output by log level
Some people are accustomed to log information level output to different names of files, such as Info.log,error.log,warn.log, in the LOG4J2 can be configured by the filters to implement.
It is assumed that
MongoDB remote connection with configuration, divided into the following 4 steps.1. Add admin account?
1 2 3
> Use admin switched to DB admin > Db.adduser (' Tank ', ' test ');
2, configure mongodb.conf?
1 2
Using Spring data MongoDB v1.8Demand 1,The data structure is as follows. Description: Change the collection record is the company each system's access situation (LocalPath represents the system, RequestTime represents the request time, the string
MongoDB BasicsStage One, understanding MongoDB1, the basic form of data of MongoDB organizationMongoDB ———— Database ———— "collection ————" documentationMySQL: Table: Rows and Columns: FieldsApplication scenarios: such as real-time information about
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