Skip to content

Instantly share code, notes, and snippets.

@yamaneko1212
Created December 4, 2011 22:06
Show Gist options
  • Save yamaneko1212/1431439 to your computer and use it in GitHub Desktop.
Save yamaneko1212/1431439 to your computer and use it in GitHub Desktop.
なんかよくわからんが, すごい短い間隔でDBをドロップすると, GridFSの部分で失敗する. あとで細かいことを検証しよう.
# -*- coding: utf-8
# This code doesn't work correctly.
# Reproduced on Python 2.7, Mongodb 1.8.4, pymongo 2.0.1 and mongoengine 0.5
from mongoengine import Document, FileField, connect
import pymongo
db = 'my_test'
class C(Document):
f = FileField()
def drop_db():
con = pymongo.Connection()
con.drop_database(db)
return
def test_code():
c = C()
c.f = 'data'
c.save()
return
if __name__ == "__main__":
connect(db)
drop_db()
test_code()
drop_db()
test_code()
drop_db()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment