<aside> 👉 Links (Property base class)
Notion Ruby Mapping Public API Reference
</aside>
<aside> 💡
[P] means methods for Page Property, [DB/DS] means methods for Database or DataSource Property.
</aside>
Filter methods build a Query; they do not execute a request, change the rollup settings, or update a calculated Page property value. Inspect the generated Hash with query.filter, or pass the Query to ds.query_data_source to execute it.
Set another_type: to match the rollup result. Numeric and date aggregation results use "number" or "date" with condition: nil. Array results require condition: "any", "every", or "none" together with the element filter type. Rich text elements use "rich_text", not FormulaProperty's "string". The library does not infer or validate these choices. Select an operator supported by the actual result or element type.
For arrays, any matches at least one element, every applies the condition to every element, and none matches no element satisfying the condition. These keywords select array conditions; do not use them for numeric or date aggregation results.
All examples assume a retrieved DataSource ds. They illustrate different rollup configurations, not one property returning all result types at once.
rollup = ds.properties["RollupTitle"]
Date filters accept Date, Time, DateTime, or an ISO 8601 String. Time values are formatted to seconds with their UTC offset; DateTime values use iso8601; Strings pass through unchanged. Date values expand using the process's current local UTC offset, not a timezone stored on the property or a historical offset for the given date. Date examples showing +09:00 assume that local offset. Equality methods also accept String or Numeric values when paired with the corresponding filter type.
Builds a after condition for a date aggregation result. Set another_type: "date". An exact Date argument expands to 23:59:59 on that day; Time, DateTime, and String values follow the common conversion rules above. For date array elements, also specify condition:.
rollup.filter_after(Time.new(2022, 2, 12, 12, 0, 0, "+09:00"), another_type: "date").filter
# => {"property"=>"RollupTitle", "rollup"=>{"date"=>{"after"=>"2022-02-12T12:00:00+09:00"}}}
Builds a before condition for a date aggregation result. Set another_type: "date". An exact Date argument expands to 00:00:00 on that day; Time, DateTime, and String values follow the common conversion rules above. For date array elements, also specify condition:.
rollup.filter_before(Time.new(2022, 2, 12, 12, 0, 0, "+09:00"), another_type: "date").filter
# => {"property"=>"RollupTitle", "rollup"=>{"date"=>{"before"=>"2022-02-12T12:00:00+09:00"}}}
Builds a condition on rich text elements containing the String value. Specify an array condition and another_type: "rich_text".
rollup.filter_contains("abc", condition: "any", another_type: "rich_text").filter
# => {"property"=>"RollupTitle", "rollup"=>{"any"=>{"rich_text"=>{"contains"=>"abc"}}}}