Skip to content

unable to access gridfs in a different database #1365

Open
@spitzbubchen

Description

@spitzbubchen

I've been accessing my other database just fine using db_alias for most collections that do not contain FileField() or ImageField() fields. However, for collections with FileField() or ImageField() I have not been able to access the file in the other database. Does db_alias not properly link fs.files and fs.chunks in the other database? Must one somehow add meta = {"db_alias": "OtherDB"} to fs.files and fs.chunks?

class File(db.Document):
     file = db.ImageField()
     meta = {"db_alias": "OtherDB"}

for i in File.objects.all():
     print i.file          # Shows '<ImageGridFsProxy: (no file)>'
     print i.file.length   # Shows 'AttributeError'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions