Creating dynamic database structure with CouchDB?
I'm new to CouchDB and want to give it a try. But before I do that I want to know if I can create dynamic database structure in CouchDB.
Eg.
- The user starts on a blank thread and chooses whatever structure he/she wants (eg. title, body and tags and fill them in)
- When he clicks save thread the database for this is created, maybe nested if necessary.
- Then the user could get the thread from the database and开发者_高级运维 read it.
Questions:
Is this dynamic creation of database structure possible?
I also read that you have to predefine views that will be used to get the documents. But how can you predefine views for data that yet doesn't exist and you have no idea what data and structure the user is going to create.
- Yes, CouchDB's document appear from the outside like a JSON object in which you can put whatever you want except probably for a few reserved fieldnames for handling document ids and revisions.
- These "predefined" views are themselves just documents, so you can modify them dynamically.
If what you require is more in the direction of searching then there are some ways out there to integrate solr with CouchDB which provides a more dynamic approach to queries.
精彩评论