Tags: pwd create data index reads read-write read function San
0, Login Admin library, open a MONGO shell
MONGO--port 27017-u "AdminUser"-P "adminpass"--authenticationdatabase "admin"
1, first switch to a new database TestDB
Use TestDB
2. Create an authenticated user for the database
Tags: Connection successfully initialized string authorization Select Create SEL connection number1 initialization After you create the database, you can type MONGO directly (if the port is the default 27017) Use admin--Select Admin Database Db.createuser ({User: ' admin ', pwd: ' admin123 ', roles: [{role: ' Root ', db: ' Admin '}]}) The user is then shown to be
I. Overview
This blog is about how MONGO db imports and exports data, as well as backup data.
The
service side of MONGO DB needs to be opened in order to operate.
Second, export.
the export of MongoDB is very simple open cmd input below command
mongoexport-d foobar-c persons-o D:/persons.json
Tags: also requires thread err read Shell Mon ref for SOCThe error message is as follows: [Email protected] bin]# MONGOMongoDB Shell version V3.4.6-22-ga109a23Connecting to:mongodb://127.0.0.1:270172017-10-16t10:57:28.624+0800 W NETWORK [Thread1] Failed to connect to 127.0.0.1:27017, in (checking socket for error after Poll), Reason:connection refused2017-10-16t10:57:28.625+0800 E QUERY [thread1] error:couldn ' t connect to server 127.0.0.1:27017, connection attempt faile B |[Email protected]/
Mongodb:https://www.mongodb.com/download-center#communityThe native installation directory is as follows:The configuration steps are as follows:1. Create a new folder data (a folder called DB in the folder), new folder log (new Mongodb.log file)2. Create a new mongod.conf file with the following file configurationDBPath = D:\install_pack\mongodb\data\dblogpath = D:\install_pack\mongodb\log\mongodb.loglogappend = Trueport = 270173. Open DOS window in bin directory execute command: mongod-fd:\inst
Tags: man SSI onchange returns control following ROR scripts LuaYou can write scripts for the MONGO Shell in JavaScript this manipulate data in MongoDB or perform administrative Operation. For more information about the MONGO Shell, see the Running. js files via a MONGO shell Instance on the Server SE Ction For more information about using these
In addition to the documentation in the MongoDB Manual, the MONGO Shell provides some additional information in I TS "Online" Help system. This document provides a overview of accessing this Help information.Command line HelpThe list of options and help for starting the MONGO shell with the --help option from the command LineMONGO--helpShell HelpTo see the list of help, in the
mongod
Note that you do not need to use kill-9.-9 will cause database corruption.Mongodb repair
It's easy to add the-repair parameter at startup.Mongod-dbpath/data/db-repairAbnormal restart or kill-9 can cause mongodb database damage.Install and install the php driver
pecl install mongoInstall the python driver
Apt-get install python-pippip install pydeskroot @ iZ28ywqw7nhZ :~ # PythonPython 2.7.3 (default
Customize the PromptModify the content of the prompt by setting the variable prompt in the MONGO shell. The promptvariable can hold strings as well as JavaScript code. If prompt holds a function that returns a string, the MONGO can display dynamic information in each prompt.You can add the logic for the prompt in the. mongorc.js file to set the prompt each time you start the
I. Installation of mango on Mac OS x1. Open the terminal window and paste the following script to install Homebrew:Ruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"2. In the terminal Update Brew, open the command line input:Brew Update3. Install MongoDB:Brew Install MongoDB4. Create the/DATA/DB directory:Mkdir-p/data/db5.run MongoDB:Directly on the command line, enter: MONGO, the default connected time test
Some data types in the MONGO database cannot be serialized with JSON, such as Objectid or datetime.datetime types.Can be through json. Jsonencoder to handle it.ImportJSONImportPymongo fromBsonImportObjectIdImportdatetimeclassJsonencoder (JSON. Jsonencoder):" "processing Objectid, this type cannot be converted to JSON" " defdefault (Self, O):ifisinstance (O, ObjectId):returnstr (o)ifisinstance (O, datetim
MongoDB BSON provides support for additional data types than JSON. Drivers provide native support for these data types in host languages and the MONGO Shell also provides several h Elper classes to support the use of these data types in the MONGO JavaScript Shell. See the Extended JSON Reference for additional information.TypesdateThe MONGO Shell provides various
"Go" couldn't connect to server 127.0.0.1: 27017 at src/mongo/shell/mongo. js: 145, "go" 27017
Couldn't connect to server 127.0.0.1: 27017 at src/mongo/shell/mongo. js: 145. For more information, see.
It should be because the installation was not timely yesterday, and the language expression was a little poor, underst
Recently, I started to learn how to install Mongo in windows. It is not difficult to perform this operation. I still use it in Linux. But refer to some documents after installation. The title error was found when Mongo was started.
Finally, this problem is solved by setting the path again.
Solution: Enter the following command
[root@localhost mongodb]# ./bin/mongod -dbpath=/data/db
Then, the following page
Mongo/mysql, field Add "-00", mongo-00========================================================== ================================= Phil-PROD-20141212, add "-00" ========You need to modify problematic data (batch) of online dianfu Bao data and easily related data)MongodbBindingloanAdd '-00' to loanAccountId'MySql needs to select LoanAccountId from KyPayAccountsAfter LoanAccountId, '-00' is added to records w
,"Lastheartbeat": "Mon-11:39:07 GMT-0400",}],"OK": 1}Here is a value of "mystate", if this value is 1, the description is the Master node (master), or 2, the slave node (slave).At the same time, each group of Replica sets has only one Primary, which is used to accept write operations. It is then replicated asynchronously to the other member database. Once the primary is dead, it will automatically vote to elect the successor primary, and the original
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.