In the recent study of Nodejs, here are some APIs that use mongoose to manipulate MongoDB.
Prelude:
1. Installation of Mongoose:var Mongoose = require (' Mongoose ');
2. Connecting Mongodb:mongoose.connect (' Mongodb://localhost/nodejs ');
3.
1. Download the Windows version of the MongoDB database
Download the MongoDB version of Windows to the official download page, 32-bit or 64-bit to choose from your own situation
Http://www.mongodb.org/downloads
2. Installation Preparation
First, the common command
1. Help View command Prompt
Help
Db.help ();
Db.yourColl.help ();
Db.youColl.find (). Help ();
Rs.help ();
2. Switch/CREATE Database
Use Yourdb; The current database is created automatically when a
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
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
Two ways to MongoDB paginationMongoDB paging query is done by limit (), skip (), sort (), which is a combination of three functions for paging queries.Here's my test data.Db.test.find (). Sort ({"Age": 1});The first of these methodsQuery the first
The traditional relational database is generally composed of three levels of database, table, records (record),
MongoDB are made up of three levels of databases (database), Collections (collection), document objects (documents)。 MongoDB for tables
Generally take the first method, directly transfer files, the second method suitable for the generation of data not saved to the local upload but directly to the binary system to MongoDB, the third way is to directly upload the form of the file into
Description
Operating system: CentOS 5.X 64-bit
IP Address: 192.168.21.128
To achieve the purpose:
Install Configuration MongoDB Database
Specific actions:
First, close the SELinux, configure the firewall
1, Vi/etc/selinux/config
#SELINUX
Split table is a common solution to the bottleneck of a single table database, in the actual application scenario can partially solve the single table write pressure and read pressure, but also bring some more complex impact:
Aggregating queries
1, how to start the MongoDB database?: After installing MongoDB, the folder appears as follows:MongoDB opens 27017 port by default, open browser, enter http://localhost:27017/, display as follows:To start a database step:(1) CD
MongoDB as a document database, support shard storage, scale-out, cluster automatic switch, the following summary configuration steps summarized as follows:Several important concepts:Database: Collection--record--cursor (tag ordinal at
MongodbThe difference between 1.mongodb and other NoSQL databasesWe should have been exposed to Redis or memcached, they belong to the Key-value database, they use the hash algorithm to correlate, can achieve fast query purposes.While MongoDB is a
Preface:As the Columnstore concept matures, more and more developers are embracing mongodb,hbase, a large-storage, distributed, Columnstore database. In particular, MongoDB's rapid construction, the rapid use of features, so that it gets more people'
Export MongoDB data based on time filtering1. Convert the time in MongoDB to a timestamp first:Isodate ("2016-12-01 00:00:00.000+08:00"). ValueOf ()1334592000000Then you can query based on the time stamp obtained.Export:- D is the database- c is a
Recently, the security team detected that some Alibaba Cloud users have unauthorized access to the MongoDB database. This vulnerability is harmful and can easily cause database leaks. To ensure the security of your business and applications, you
The installation code is as follows:Tar-zxf mongodb-linux-x86_64-2.6.5.tgzMusic mongodb-linux-x86_64-2.6.5/usr/local/Cd/usr/localMusic mongodb-linux-x86_64-2.6.5 mongodb // Create a data directoryMkdir/data2/mongodbData// Create a log file (note
Replica set multi-server master/slave, add and delete nodes, which are common. The following describes how to add or delete a node in detail.1. Use rs. reconfig to add and delete nodes1. Add nodes The code is as follows:Copy code Repmore:
Only one cm database is migrated. The target database is version 2.4.8 and the original database is version 2.4.6. Therefore, hot backup is used for migration.The official document is very simple: The code is as follows:Copy code Mongodump-host
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