Skip to content

Instantly share code, notes, and snippets.

@di97mni
Created January 28, 2015 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save di97mni/d39f92990d1b1f83cd2b to your computer and use it in GitHub Desktop.
Save di97mni/d39f92990d1b1f83cd2b to your computer and use it in GitHub Desktop.

Example

Product A

Pricelist 1

1/1 2/1 3/1 4/1 5/1 ...
$100 - $120 $100 $90 ..

Pricelist 2

1/1 2/1 3/1 4/1 5/1 ...
$110 $100 $140 $110 $100 ...

Product B

Pricelist 1

1/1 2/1 3/1 4/1 5/1 ...
$200 $200 $220 $200 $140 ...

Pricelist 2

1/1 2/1 3/1 4/1 5/1 ...
$210 $200 - - $200 ...

Example of Queries

  1. Prices for period 2/1-4/1
  2. Prices for Product A/Pricelist 2 for period 2/1-4/1

Output of query 1:

Product A
  Pricelist 1 - missing price
  Pricelist 2 - $350

Product b
  Pricelist 1 - $620
  Pricelist 2 - missing price

Right now the document looks like this:

Product
  Pricelists*
        Prices* {Day;Price}

Denormalized Index

ProductId
PriceListId
Day
Price
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment