Factor out BSONAPI into lib.views