Skip to content

getting error when using MongoBackend  #67

@ShawnXu

Description

@ShawnXu

I was glad to find out that blitzdb offers a MongoDB wrapper so I tried it out. Unfortunately I couldn't get it to work

>>> backend = blitzdb.MongoBackend('mongo://127.0.0.1:27017/', True)
>>> doc = blitzdb.Document({'name': 'Shawn'})
>>> doc.save(backend)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Users\shawn\AppData\Local\Programs\Python\Python35-32\lib\site-packages\blitzdb-0.2.12-py3.5.egg\blitzdb\document.py", line 449, in save
    return backend.save(self)
  File "c:\Users\shawn\AppData\Local\Programs\Python\Python35-32\lib\site-packages\blitzdb-0.2.12-py3.5.egg\blitzdb\backends\mongo\backend.py", line 151, in save
    return self.save_multiple([obj])
  File "c:\Users\shawn\AppData\Local\Programs\Python\Python35-32\lib\site-packages\blitzdb-0.2.12-py3.5.egg\blitzdb\backends\mongo\backend.py", line 144, in save_multiple
    self.db[collection].save(attributes)
TypeError: string indices must be integers

I'm sure my mongodb server is running fine. I suppose the usage against the MongoDB backend should be the same. There isn't much documentation on read docs. Am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions