LocalData / localdata-tiles

A tileserver for LocalData
5 stars 2 forks source link

Filter entries thoroughly #126

Open prashtx opened 9 years ago

prashtx commented 9 years ago

Because mongo doesn't let us match the "last element of an array" (only specific numbered positions), our query for filtered tiles will match responses where an old entry satisfies the filter but the newest entry (which we actually care to render) does not. #125 works around that by making sure filtered tiles only use one color. But really, we shouldn't be passing entries down the pipeline if we don't want them drawn. And if the understanding is that the map only shows the latest entry for each underlying object, then this workaround could still be confusing.

Investigate the tradeoffs (particularly performance) of the following

  1. Finish the filtering in the app, possibly in the transform stream that generates GeoJSON filters
  2. Use the aggregation pipeline, which would let us apply the match conditions early, to filter the incoming objects, and then again after unrolling the entries and possibly tossing out all but the newest.

Option 2 might require a cursor, which might only be supported for the aggregation pipeline as of MongoDB 2.6.