Skip to content

0.16.0

Compare
Choose a tag to compare
@ramnes ramnes released this 22 Feb 11:38
· 19 commits to master since this release

Happy to release Mongo-Thingy 0.16.0, that has quite a few interesting features!

  • Mongomock-Motor has been added to the list of supported backends.
  • You can now play with camel case data without giving up on snake case in your Python code. 🤯
    The new CamelCase mixin translates attributes accesses from snake case to camel case. For example, thingy.foo_bar will access the fooBar field of the document. Just add the mixin to your class signature and you're good to go!
  • Views could already be applied on cursors, but not at a later stage (i.e. when the cursor is exhausted). You can now apply views on result lists as well:
    >>> users = User.find().to_list(None)  # Note the `to_list(None)` here! Users are now fetched and in memory.
    >>> for credentials in users.view("credentials"):
    ...     print(credentials)
    {'username': 'MrFoo', 'password': 't0ps3cr3t'}
    {'username': 'MrsBar', 'password': '123456789'}
    This works because we now wrap results in a list subclass named ThingyList, meaning that you can extend that class to implement your own operations on result lists!
  • Mongo-Thingy now exposes most of the PyMongo collection write methods directly at the Thingy level, such as Thingy.update_one. You don't need to play with Thingy.collection anymore when you want to run optimized queries.

Thanks to our new contributor @Flowtter for his work on that release!

Full Changelog: 0.15.1...0.16.0