F:\soft\mongodb-win32
-i386-1.2.4>bin\mongod.exe --dbpath=f:/mongodb
Mon Mar 08 11:13:17 Mongo DB : starting : pid = 0 port = 27017 dbpath = f:/mongodb master = 0 slave
= 0 32-b
IT ** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
** see http://
blog.mongodb.
org/post/137788967/32-bit-limitations for more
Mon Mar 08 11:13:18 db version v1.2.4, p
DFile version 4.5
Mon Mar 08 11:13:18 git version: 5
CF582d3d96b882c400c33e7670b811ccd47f477
Mon Mar 08 11:13:18
Sys info: windows (5, 1, 2600, 2, 'Service Pack 3') BOOST_LIB_VERSION=1_35
Mon Mar 08 11:13:18 w
aiting for connections on port 27017
--dbpath 指定数据库的目录,默认是 /data/db,win 没有 /data/db 目录,所以直接双击 mongod 是启动不了。默认端口是 27017
F:\soft\mongodb-win32-i386-1.2.4>bin\mongo.exe
MongoDB shell version: 1.2.4
url:
test connecting to: test
ty
PE "exit" to exit
type "help" for help
> use test
switched to db test
> db.foo.save({a:1})
> db.foo.find()
{ "_id" : ObjectId("4b946bc03f78000000001542"), "a" : 1 }
>
From pymongo import Connection
connection = Connection()
db = connection.test
for f in db.foo.find():
PRint "a=%s, _id=%s" % (f['a'], f['_id'])