简体   繁体   English

文档存储中缓存副本的名称是什么?

[英]What's the name for a cached copy in a document store?

Nontechnical, naming question: 非技术性的命名问题:

I've got a document that contains a reference to another document. 我有一个文档,其中包含对另一个文档的引用。 Most times I access it I need a couple fields from the referred document, so I store those alongside the reference to avoid the lookup. 多数情况下,我需要从引用的文档中获取几个字段,因此我将这些字段与引用一起存储以避免查找。

Mongo example: Mongo示例:

auto 汽车

{
  'color' : 'blue',
  'maker' : {
     '_id' : '1234',
     'name' : 'Ford'
  }
  ...
}

maker 制作者

{
  '_id' : '1234',
  'name' : 'Ford',
  'ceo' : 'Alan Mulally'
  ...
}

So the auto.maker.name is not a primary source-- it should never be changed, except as a result of the maker's name being changed, which is costly but very rare. 因此,auto.maker.name并非主要来源-绝不可更改,除非更改了制造商的名称,这很昂贵,但非常罕见。

What do you call this field? 你怎么称呼这个领域? The best I've seen is 'cached' but that's pretty overloaded, particularly when talking about data storage. 我所见过的最好的方法是“缓存”,但是这非常重载,尤其是在谈论数据存储时。 Is there a better term? 有更好的名词吗?

To be completely honest, you should really look at changing your schema to fit within the guidelines of NoSQL and in particular Mongo. 老实说,您应该真正考虑更改架构以使其符合NoSQL(尤其是Mongo)的准则。

You really don't want an architecture where you're having to look things up on each query. 您确实不想要一种必须在每个查询中查找内容的体系结构。

If you have to name it something; 如果您必须命名的话; I'd name this data what it's pointing to; 我将此数据命名为指向的数据; in this case your _id is marker_id or at least have it reference your secondary lookup table so that in the code you're using to query this you can write a generic condition on the particular column and will know where to find it's lookup value. 在这种情况下,您的_id是marker_id,或者至少让它引用了辅助查找表,以便在您用来查询它的代码中,您可以在特定列上编写通用条件,并知道在哪里可以找到它的查找值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在文档中存储对gridFS文件的引用的最佳方法是什么? - What's the best way to store references to a gridFS file in a document? 使用 findByIdAndDelete 删除该文档后如何将文档副本存储到变量中? - How to store copy of document into a variable after deleting that document with findByIdAndDelete? 什么是存储数千个中型文档的最有效的面向文档的数据库引擎? - What's the most efficient document-oriented database engine to store thousands of medium sized documents? 从文档中删除空字段的名称 - Remove empty field's name from document 使用 NoSQL 文档存储数据库有哪些实际用例? - What are some real use cases for going with a NoSQL Document Store db? 在 MongoDB 中存储数据的最佳方式是什么? - What's the best way to store data in MongoDB? 在哪里存储用户关注/关注者? 用户的Followings收集文件? 胖文件VS. 多态文件 - Where to store users followings/followers? User's document of Followings collection? Fat document VS. polymorphic documents MongoDB:如何找到他们的名字以“S”和“R”开头的文档? - MongoDB: How Find the document where their name starts with “S” and “R”? 如何重命名嵌入式文档的关键字段名称 - how to rename embedded document's key field name 用猫鼬复制文件 - Copy document with Mongoose
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM