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

48 Views Asked by At

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:

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.

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?

1

There are 1 best solutions below

2
On

To be completely honest, you should really look at changing your schema to fit within the guidelines of NoSQL and in particular 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.