Find all the objects with invalid header/parent in Cassandra


#1

Is there an easy way to find all the objects with parent.meta.referenceInvalid == true in Cassandra?

Fetch on the related Type does not work since the filtering must be done on parent first and the fetch command sends this error:
{name: "ActionError", message: "Invalid query [Query - Root Type: RiskScore Filte… True] Limit: 2000: Filter by parent is required."

Those “orphan” objects do not have any valid parent to filter on…


#2

you need to first provide a filter over the partition key which is usually the parent field. So in your case:

var ppms = PointPhysicalMeasurementSeries.fetch({include: 'id'});
var pms = ppms.reduce(function(acc, curr) {
  var result = PointMeasurement.fetch({
    filter: Filter.eq('parent.id', curr.id).and.eq('parent.meta.referenceInvalid', true)
  });
  return acc.push(result.objs);
}, [])