Couchbase NoSQL文档模式

时间:2015-11-14 04:23:03

标签: couchbase nosql

我是NoSQL和基于文档的模式的新手,我正在开发一个基于健身房的培训应用程序。我试图找出执行以下操作的最佳方法:

有许多“基础活动”,每个都有变化。基本活动下面是#1,变种#2到#8。

1|15º Decline Bench Press, Barbell, Close Grip
2|15º Decline Bench Press, Thick Barbell, Close Grip
3|15º Decline Bench Press, Barbell, Close Grip, With Chains
4|15º Decline Bench Press, Thick Barbell, Close Grip, With Chains

5|15º Decline Bench Press, Barbell, Close Grip, With Bands Assisting
6|15º Decline Bench Press, Thick Barbell, Close Grip, With Bands Assisting
7|15º Decline Bench Press, Barbell, Close Grip, With Bands Resisting
8|15º Decline Bench Press, Thick Barbell, Close Grip, With Bands Resisting

由于每种变化被认为是一种先进的训练技术,我不会提供单独的视频显示技术,也不需要任何不同的基于文本的教学信息,因此这些变化在他们的由于存在大量冗余数据,因此自己的活动文档。拟议活动文件的JSON可以在下面看到。

{
  "id": "a::1",
  "doctype": "activity",
  "lay_name": "15º Decline Bench Press, Barbell, Close Grip",
  "coach_name": "Bench Press, 15º Decline, Barbell, Close Grip",
  "type": "resistance",
  "author": "",
  "exp_level": "intermediate",
  "contraindicated": [
    "Shoulder Impingement"
  ],
  "technique_videos": {
    "correct": "/folder/folder/file1.mp4",
    "incorrect": "/folder/folder/file2.mp4"
  },
  "equipment": [
    "Barbell",
    "Decline Bench"
  ],
  "tags": [
    "Free Weight",
    "Mass Builder",
    "Indoor"
  ],
  "activity_variation": [
    {
      "variation": "thick_barbell",
      "lay_name": "15º Decline Bench Press, Thick Barbell, Close Grip",
      "coach_name": "Bench Press, 15º Decline, Thick Barbell, Close Grip"
    },
    {
     "variation": "with_chains",
      "lay_name": "15º Decline Bench Press, Barbell, Close Grip, With Chains",
      "coach_name": "Bench Press, 15º Decline, Barbell, Close Grip, With Chains"
    },
    {
     "variation": "thick_barbell_with_chains",
      "lay_name": "15º Decline Bench Press, Thick Barbell, Close Grip, With Chains",
      "coach_name": "Bench Press, 15º Decline, Thick Barbell, Close Grip, With Chains"
    },
    {
     "variation": "with_bands_assisting",
      "lay_name": "15º Decline Bench Press, Barbell, Close Grip, With Bands Assisting",
      "coach_name": "Bench Press, 15º Decline, Barbell, Close Grip, With Bands Assisting"
    },
    {
     "variation": "thick_barbell_with_bands_assisting",
      "lay_name": "15º Decline Bench Press, Thick Barbell, Close Grip, With Bands Assisting",
      "coach_name": "Bench Press, 15º Decline, Thick Barbell, Close Grip, With Bands Assisting"
    },
    {
     "variation": "with_bands_resisting",
      "lay_name": "15º Decline Bench Press, Barbell, Close Grip, With Bands Resisting",
      "coach_name": "Bench Press, 15º Decline, Barbell, Close Grip, With Bands Resisting"
    },
    {
     "variation": "thick_barbell_with_bands_resisting",
      "lay_name": "15º Decline Bench Press, Thick Barbell, Close Grip, With Bands Resisting",
      "coach_name": "Bench Press, 15º Decline, Thick Barbell, Close Grip, With Bands Resisting"
    }
  ],
  "description": "Excellent mass builder that focuses on the lower part of the pec.",
  "technique_description": [
    "1. bla bla",
    "2. Bla bla",
    "3. Bla bla",
    "4. Bla bla"
  ],
  "prime_mover": "Pectoralis Major",
  "focus": "Pectoralis Major - Sternal Head"
}

首先,需要查询这些活动(或者您喜欢的练习),然后将其作为单独的活动呈现,例如:

其次,他们还需要与(健身计划和)个人锻炼(由活动组成)和用户记录他们举起的锻炼(代表,套装,体重),锻炼,在某一天。所以我试图找出设计架构以适应这种情况的最佳方法。我也在想用户应该能够在设置中指定他们可以访问哪些设备,以及他们是否没有例如。链,然后当他们查询练习列表时,他们不会显示相关的练习。

问题:

  1. 有人可以建议一个比我上面更好的架构/流程吗?也许一个单独的文档采用活动密钥并存储该密钥(活动)的相关变体会更好?建议好吗?
  2. 鉴于#1的答案,在存储锻炼中的用户数据时,我应该如何处理这些名称变化,例如:
  3. “15º下降卧推,厚杠铃,紧握,带链”

0 个答案:

没有答案