mongodb and attributes

I would like to use mongodb to store records that have a variable number of attributes. However, it appears that Yii is asking me to define all possible attributes in the attributes() method. This seems counter intuitive; one of the great things about mongo is that it is schemaless, so why is attributes() compulsory. Is there a way around this/different approach?

I’m using Mongo on a current project and also found the native AR implementation lacking in various aspects. I instead just wrote a Model class that interacts with the database the way I want via yii\mongodb\collection.

I’m doing the same but it really really seems like there must be a better way, most of Yii2 is so rich and well thought out it I find it hard to believe that its the “proper” or only way.