MongoDB Windows installation and how to configure Python support

Source: Internet
Author: User
Tags mongodb mongodb windows

The recent study of massive data analysis, finally ran to the database, read the introduction, but really feel good.


The following are Windows installations and simple actions

First go to the official website to download:

http://www.mongodb.org/

Remember to download the corresponding version.

Extract the file into the C:\mongoDB directory.

Run: Command bar MongoDB installed into system services.

Where--dbpath is the specified database directory,--logpath specifies the log file

"C:\mongoDB\bin\mongod.exe"--dbpath "C:\yk"--service--logpath "C:\yk\log.log"

Note: This is just to build a test environment, some security issues such as account password settings, if you want to set can refer to Mongod--help parameter content to set.


Then the direct operation of Mongo.exe can be connected to the computer by default.

After the installation is ready to get started, the page provides some introductory things.

In fact, it is better to knock yourself several times.

Http://www.mongodb.org/display/DOCS/Tutorial

We can also implement the database processing in other languages, I use python3,2,

py3.2 version of the support module download:

Http://pypi.python.org/packages/3.2/p/pymongo3/pymongo3-1.9b1.win32-py3.2.exe#md5=4238649fe52459d54c76ad8a926408f9

>>> Import Pymongo
>>> connection = Pymongo. Connection ("localhost", 27017)
>>> db = connection.test
>>> db.name
' Test '
> >> db.my_collection
Collection (Database (Connection (' localhost ', 27017), ' Test '), ' my_collection ')
>>> Db.my_collection.save ({"X": Ten})
ObjectId (' 4aba15ebe23f6b53b0000000 ')
>>> db.my_ Collection.save ({"X": 8})
ObjectId (' 4aba160ee23f6b543e000000 ')
>>> db.my_collection.save ({"X":
ObjectId (' 4aba160ee23f6b543e000002 ')
>>> db.my_collection.find_one ()
{' x ': ' _id ' : ObjectId (' 4aba15ebe23f6b53b0000000 ')}
>>> for item in Db.my_collection.find ():
...     Print (item["x"])
...
8
>>> db.my_collection.create_index ("x")
' x_1 ' >>> for
item in Db.my_collection.find (). Sort ("X", Pymongo. Ascending): ...     Print (item["x"])
...
8
>>> [item["X"] for the item in Db.my_collection.find (). Limit (2). Skip (1)]
[8, 11]



Other people's summary of it

http://www.wentrue.net/blog/?p=772


A good Python description:

Http://blog.nosqlfan.com/html/2989.html

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.