我在 Openshift 中使用 Python + MongoDB + PyMongo
import os
import gridfs
from django.http import HttpResponse
from pymongo.connection import Connection
from django.shortcuts import get_object_or_404, render_to_response
from django.http import HttpResponseRedirect, HttpResponse
from django.template import Context, RequestContext,loader
connection = Connection('mongodb://sbose78:XXXXXX@staff.mongohq.com:10068/BOSE')
db=connection['BOSE']
fs=gridfs.GridFS(db)
当我通过 _id 查询文件时,这就是我得到的。
>>> fs.exists({"_id":'504a36d93324f20944247af2'})
False
当我使用相应的文件名查询时:
>>> fs.exists({"filename":'foo.txt'})
True
可能出了什么问题?
谢谢。