#!/usr/bin/env python
#coding=UTF-8
from pymongo import Connection
from pymongo import database
from pymongo import collection
conn = Connection('192.168.0.1', 27017)
db = database.Database(conn, 'Mydb')
col = collection.Collection(db, 'mapping')
cur =col.find({"ID":"001"})
results = cur.limit(0)
for r in results:
#coding=UTF-8
from pymongo import Connection
from pymongo import database
from pymongo import collection
conn = Connection('192.168.0.1', 27017)
db = database.Database(conn, 'Mydb')
col = collection.Collection(db, 'mapping')
cur =col.find({"ID":"001"})
results = cur.limit(0)
for r in results:
print r
返回结果是一个dict类型