ITPub博客

首页 > Linux操作系统 > Linux操作系统 > CouchDB中的Schemas详解

CouchDB中的Schemas详解

原创 Linux操作系统 作者:jieforest 时间:2012-09-10 09:03:44 0 删除 编辑
1 technical a representation of a plan or theory in the form. of an outline or model: a schema of scientific reasoning.

2 Logic a syllogistic figure.

3 (in Kantian philosophy) a conception of what is common to all members of a class; a general or essential type or form.

CouchDB is a schema-less document store, but there are times when a schema is a good thing to have around, one way or another. So can you have your cake and eat it too?

Below I'll take a high level look at adding a kind of schema to an application and the benefits and draw backs associated with this way of working. What I describe below isn't for everyone. It goes against some of the core principles of CouchDB and makes your data much less human readable, but there are cases where that trade off is worth making.

[b]Schemas: WTF?![/b]

It might seem a bit weird to add a schema to a schema-less database but sometimes it is a very useful thing indeed. When you're dealing with large datasets verbose object key names can be a problem (e.g. cost you money) so you end up stuck between a rock and a hard place; either make your data terse and hard to use or be explicit and spend more on storage and network.

1.{
2."shape": "triangle",
3."colour_label": "red",
4."opposite_length_in_mm": 767.12254256805875,
5."angle_in_radians": 1.5514293603308698,
6."adjacent_length_in_mm": 73.59881843627835
7.}

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/301743/viewspace-742994/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-04-23

  • 博文量
    441
  • 访问量
    602361