Allow any object as document

- Allow any kind of python object that implements the dictionary
  interface as document.