开发者

Creating dynamic database structure with CouchDB?

开发者 https://www.devze.com 2023-01-16 07:44 出处:网络
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.

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.

  1. The user starts on a blank thread and chooses whatever structure he/she wants (eg. title, body and tags and fill them in)
  2. When he clicks save thread the database for this is created, maybe nested if necessary.
  3. Then the user could get the thread from the database and开发者_高级运维 read it.

Questions:

  1. Is this dynamic creation of database structure possible?

  2. 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.


  1. 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.
  2. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消