The mongo official website has provided a detailed introduction to mongoDB installation and configuration. Here we only list some scripts for mongoDB configuration, for your reference only.
-- Enter the bin directory
Mongod-dbpath "d: \ mongodb"
-- Install the window service
Use the-dbpath parameter to specify the database directory, -- logpath indicates the log storage directory, and the-serviceName parameter indicates that the service name installed by the command is MongoDB.
Mongod -- logpath d: \ mongodb \ log -- logappend -- dbpath d: \ mongodb -- directoryperdb -- install
-- Delete a service
Mongod-remove-serviceName "MongoDB"
-- Database operation script, from the official website
C: \> cd \ my_1__dir \ bin
C: \ my_1__dir \ bin> mongo
> // The mongo shell is a javascript shell connected to the db
> // By default it connects to database 'test' at localhost
> 3 + 3
6
> Db
Test
> // The first write will create the db:
> Db. foo. insert ({a: 1 })
> Db. foo. find ()
{_ Id:..., a: 1}
> Show dbs
...
> Show collections
...
> Help
-- Create Database user newDatabaseName
> Use xiaodb
Switched to db mkyongdb
> Show dbs
Admin 0.03125 GB
Local (empty)
-- Define collection and insert data
Db. users. save ({username: "xiao "})
-- Search for inserted data
Db. users. find ()
-- Repair command
Mongod-repair