to download version 2.0.1. Or download the latest stable version as needed.
Installation: Extract the compressed package after downloading to any directory. This article assumes that it is extracted to the [D:\\mongodb] directory.
Configuration: Create a directory for data directories and log files:
Create a log file:
In the above editor interface, use [alt+f] to call up the [File] menu, select the [Save] item, and then select the [Exit] item to exit the editor. Check whether there is a log.txt file in the log directory. The following steps can be performed. If there is no existing, you can directly create an empty log.txt file on the windows interface.
Starting the mongodb service
Creating mongodb as a windows system service and starting the mongodb service.
Enter mongodb's bin directory, use mongod to create services, pay attention to the directory parameter values.
Create a service
:mongod --install --serviceName mongodb --logpath d:\\mongodb\\data\\log\\log.txt --logappend --dbpath d:\\mongodb\\data\\db --directoryperdb
Parameters: directoryperdb, optional parameters, each database is stored in a separate folder.
Start the service: net start mongodb
Use: Log in to the local mongodb
After the Mongodb service starts, open the command line tool.
Login: mongo 127.0.0.1:27017
27017 is the default port for mongodb.
Logging in to remote mongodb
Login: mongo 192.168.0.137:27017
27017 is the default port for mongodb
Basic Commands
Display the current database: db
Show all databases: show dbs
Create database: no command to create a database, you can First use [use test1] to switch the database. At this time, the database has not been created. After creating a collection under the database or adding data to the collection, the data [test1] is automatically created.
Switch database: use test
Display database collection: show collections
Create collection: db.createCollection(“users”)
View db Help for the command: db.help()
View help for the collection command: db.collection.help()
Insert data: db.users.save({“name”:&rdquo ;shiwenbin”,”age”:100})
Retrieving data: db.users.find()
Pagination: db.users.find().skip(2).limit (3)
skip, skimming the specified number of bars.
limit, get the specified number of bars.
Command Help: See the help() of any command for the help of any command to see the parameters and usage of this command.
FAQ
Chinese garbled: After inserting Chinese code, it is normal to use code to read it, but to view the inserted Chinese in the command line tool, Show garbled. This is mainly caused by the encoding of the cmd window, because the encoding of the mongodb background is utf-8, which can be solved by modifying the encoding of the cmd window.
1) Open a cmd window, type [chcp 65001]
2) Then open the properties window of the cmd window and select any font other than “ dot matrix font in the font. Font
As we all know, the Windows 2003 operating system provides remote access to the registry, only the r
Windows Server 2008s new Server Manager console tool eases the pressure on organizations to manage a
Notepad++ 6.0 is officially released for download. Notepad++ is a free, open source, green multi-lan
The process of setting up a mail server in Windows 2003 is similar to that of the XP system. It can
Four Secrets to Improve Windows 2003 Security
Windows 2003 operating system acceleration 20 strokes
IIS Security Tutorial: Making Your Web Server Log Files Safer
Clearing the fault, Windows 2003 is more intimate
Win2008 Performance and Availability Detection Tool Configuration Guide
Resolve Win2008 Recycle Bin can't clear fault
How to directly upgrade Win2008 R2 from Win2003 locally
Let Win2003 self-manage spooling
IE security settings in Windows 2003: Modify the security settings of Group Policy
Win7 IE browser suddenly can not open the page is what is the reason for how to solve
Win7 system CMD command limit is canceled How to solve
The senior network administrator teaches you to completely pull out the Windows boot worm
How to make 32-bit win7 use 4G memory is no longer a lie (2)
What should I do if the win7 system tag is deleted by mistake?
The reason why the local connection disappears from the desktop of the computer. The large inventory
Experts get a win7 broadcast web video silent problem
A concise method of replacing the Windows XP serial number