yii - form/modal based on mongodb

I am using mongo db in my yii project.

I am newbie in yii and mvc. I need to show some fields from database to user. And also allow them to edit those fields when they click edit. From what I know so far, I need a modal to create form. Modal should extend CActiveRecord (because I am allowing edit).

But I have no clue how this is going to work with mongodb ? Its very differnt from mysql (structure and fields are not definite in mongodb). Some users have field (column) abc while some do user do not have it.

I am looked into the mongodbsuite for yii. But its very hard for me to understand that at this level.

I am willing to write my own custom code, if someone can give me a direction. (or I’ll have to write my own code destroying the feel of yii/mvc. Fetching everything and inserting into textboxes and then allow users to edit those)

Would have a look at http://www.yiiframework.com/extension/yiimongodbsuite/ which implements the CActiveRecordBehavior for MongoDB. This extension unfortunately doesn’t have a current maintainer … and does have bugs that may frustrate you.

Since you’re new to Yii, MVC, and MongoDB … you’d be much better off starting with a traditional relational database (eg MySQL) to learn the application basics in the most stable development environment.

A document-oriented database such as MongoDB has different design patterns and strengths/weaknesses as compared to a relational database. Relational databases are a much better fit for the Active Record design pattern, which effectively maps the database record structure and relationships to equivalent model classes and accessors. As you’ve pointed out … a document database such as MongoDB has a more fluid schema which has major implications on data and application logic.