Add compatibility with bson