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
MongoDB database backup and recovery under Windows
I can tell the data back to the C:\data\dump directory, first create this path. And then go under the Bin directory of MongoDB.
Mine is:
C:\Program Files\mongodb\bin
The backup
MapReduce is grouped according to the first parameter of the emit function called in the map function.
Map-reduce is a computational model that simply executes a large amount of work (data) decomposition (MAP) and then merges the results into the
JavaScript scripts can be executed by the Db.eval function on the server side, and JavaScript scripts can be saved in the database and then invoked in other database commands.
One, Db.eval execute server-side script
The Db.eval function enables
Note: The MongoDB version used by the author is 2.4.7.
Examples of Getting Started
Copy Code code as follows:
conn = new Mongo ();
db = Conn.getdb ("db-name"); //Select Database
Db.auth ("User-name", "password"); //user
Interested in the MongoDb document database, to install the understanding.
To the official download win version http://www.mongodb.org/display/DOCS/Downloads is currently the latest stable version of 1.2.4. Extract to f:/sofr/mongodb-win32-i386-1.2.
The data structure he supports is very loose and is a JSON-like Bjson format, so you can store more complex data types. The biggest feature of MONGO is that the query language he supports is very powerful, and its syntax is somewhat similar to an
NoSQL is very hot, mongodb as a good distributed file storage database, also received a lot of attention, Http://weibo.com/k/mongodb Sina Weibo in the daily now about more than 20 information.
Official website: http://www.mongodb.org/
Download:
Because the document structure of MongoDB is in the Bjson format (bjson full name: Binary JSON), and the Bjson format itself supports data in binary format, you can save the data in binary format of the file directly into the MongoDB document
1. Start and stop MongoDB:
Execute the mongod command to start the MongoDB server. Mongod has many configurable options, we can view all options through Mongod--help, here are just a few of the main options:
Copy Code code as follows:
The platform has a large number of pictures have been used, the order of magnitude of millions, almost 100G of space, whether it is too wasteful?
Copy Code code as follows:
Db.fs.files.find ({filename:/xxx/}). ForEach (function (n)
MongoDB is an open source NoSQL database that is primarily used in large data situations and is considered the Node.js's golden partner, and because it uses the binary JSON format, it has no affinity to JavaScript with any language. The specific
Today to share with you the more interesting knowledge of MongoDB, mainly include: aggregation, cursors.
One: Aggregation
Common aggregation operations are the same as SQL Server: Count,distinct,group,mapreduce.
Count
Count is the simplest,
About the benefits of MongoDB, advantages and so on here is not said, the only thing to talk about is the MongoDB: Database, collection, document, where "set"
is "table" in the corresponding relational database, and "document" corresponds to "line".
Creating an index sometimes blocks new connections
When a connection is established with the MongoDB replica set, the driver first attempts to connect and validate each of the nodes that are not hidden in the cluster. If a node is a "down" state,
For example: MySQL installation configuration, there is a MySQL database, which has a user table, used to store users, as well as user rights, and MongoDB this most like relational database, there is no such a table.
One, to grasp the authority,
asp.net MVC4 use MongoDB to create album management instance sharing
TIPS: 1.Image to Base64 save to MongoDB field2. The data model is a nested association
First define the model layer:
public class Photo:iequatable {[Required] public string
Look for a long time query Objectid method is wrong, with Mongovue can query out, but is using Java do not know how to query
1.mongovue Query mode:
Copy Code code as follows:
{"_id": ObjectId ("5326bfc0e6f780b21635248f")}
2. In the
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.