Type-safe BSON-level Mongo API