Create a collection: CreateCollection () method
MongoDB db.createcollection (name, options)
is used to create a collection.
Grammar:The basic createcollection () command syntax is as follows:
Db.createcollection
To back up a database,
Mongorestore-d db/path/to/back_up
For example:
mongodump-d Bookstore-o/data01/db_backup/
This command will dump all of the DB collectionrecover data from a backup folder
Mongorestore-d
MongoDB is a database based on distributed file storage. Written by the C + + language. Designed to provide scalable, high-performance data storage solutions for WEB applications.
MongoDB is a product between relational database and non relational
The most important role of the index is to improve query performance in query, if there is no index, MongoDB need to scan the entire collection all documents, and filter eligible document, if the index, Then query only needs to traverse the index of
The production environment instance frequently OOM, the investigation discovery mainly by some $near query causes, the query resembles follows, in which the LATLNG field has established 2d index.
{"Find": "UserData",' Filter ': {"LATLNG": {"$near":
Command-line query:
1, you can use. * To fuzzy query, the following is the query surname Chen user.
Db.customers.find ({name:/Chen */i});2, also can not carry * number
Db.fs.files.find ({filename:/install_mongo.sh/i})
PHP Query:
$query =array ("
Master/slave master-slave replicationmaster-slave replication MongoDB a common way, if you want to achieve a master-slave replication should have at least two MongoDB instance, one is responsible for the client request as the primary node, and the
The company uses MongoDB to do the database function, the first use, so I went to study the next MongoDB website and related information, the local Windows environment to build a simple MongoDB database, words not to say, into the topicFirst,
MongoDB is a nosql type of database, high-performance, easy to deploy, easy to use features in the IT industry is very popular.The following describes the installation of MongoDB, here we are installed under Linux, using the centos6.4 64-bit, you
Original link: http://page.factj.com/blog/p/4078MongoDB has been popular for a long time, compared to MySQL, exactly what scenes need to use MongoDB? Here are some summaries.Higher write loadBy default, MongoDB is more focused on high data write
Copyright notice: This article by the Comte rain original article, reproduced please indicate the source:Article original link: https://www.qcloud.com/community/article/136Source: Tengyun https://www.qcloud.com/communityMongoDB single-instance mode,
First, the documentation considerations:1. Key-value pairs are ordered, such as: {"name": "Stephen", "Genda": "Male"} Not equal to {"Genda": "Male", "name": "Stephen"}2. The document information is case sensitive, such as: {"name": "Stephen"} does
Original address: Https://serholiu.com/python-mongodbThese days in the study of Python web development, so prepare to do a blog to practice practiced hand, of course, just practiced hand, blog has wordpress such a good thing, why still build their
We know that MySQL will need us to set a database default username and password when installing,MongoDB is no exception, but MongoDB is the default does not set access restrictions, You do not need to enter a user name and password to access, but
1. Update the documents in the collection with the following syntax:Db.collection.update (Criteria,objnew,upsert,multi)Parameter description:Criteria: The object used to set the query criteriaObjnew: An object for setting up updated contentUpsert:
Log on to MongoDB shell and switch to the admin databaseMongoUse adminCreate administrator userDb. createUser ( {User: "yourusername ",Pwd: "password ",Roles: [{role: "userAdminAnyDatabase", db: "admin"}] })Modify/etc/init. d/mongod and restart
PrefaceFor more information about how to install and run mongodb and how to operate mongodb using php, see my previous articles.There are already posts on mongodb operations in php in China, but there seem to be few articles about mongodb injection
Download required software (download to the/usr/local/src directory) The code is as follows:Copy code # Wget http://downloads.mongodb.org/src/mongodb-src-r1.8.1.tar.gz# Wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz# Wget
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