mirror of
https://github.com/strapi/strapi.git
synced 2025-08-23 16:19:37 +00:00
1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
![]() |
(window.webpackJsonp=window.webpackJsonp||[]).push([[52],{187:function(t,s,a){"use strict";a.r(s);var e=a(0),n=Object(e.a)({},function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("div",{staticClass:"content"},[t._m(0),t._v(" "),a("p",[t._v("See the "),a("router-link",{attrs:{to:"./../concepts/concepts.html#filters"}},[t._v("filters' concepts")]),t._v(" for details.")],1),t._v(" "),a("div",{staticClass:"note custom-block"},[a("p",[t._v("by default, the filters can only be used from "),a("code",[t._v("find")]),t._v(" endpoints generated by the Content Type Builder and the "),a("router-link",{attrs:{to:"./../cli/CLI.html"}},[t._v("CLI")]),t._v(". If you need to implement a filters system somewhere else, read the "),a("a",{attrs:{href:"#programmatic-usage"}},[t._v("programmatic usage")]),t._v(" section.")],1)]),t._v(" "),t._m(1),t._v(" "),a("p",[t._v("The available operators are separated in four different categories:")]),t._v(" "),t._m(2),t._v(" "),t._m(3),t._v(" "),a("p",[t._v("Easily filter results according to fields values.")]),t._v(" "),t._m(4),t._v(" "),t._m(5),t._v(" "),t._m(6),t._v(" "),t._m(7),t._v(" "),t._m(8),t._v(" "),t._m(9),t._v(" "),t._m(10),t._v(" "),a("p",[t._v("Sort according to a specific field.")]),t._v(" "),t._m(11),t._v(" "),a("p",[t._v("Sort users by email.")]),t._v(" "),t._m(12),t._v(" "),t._m(13),t._v(" "),a("p",[t._v("Limit the size of the returned results.")]),t._v(" "),t._m(14),t._v(" "),a("p",[t._v("Limit the result length to 30.")]),t._v(" "),t._m(15),t._v(" "),t._m(16),t._v(" "),a("p",[t._v("Skip a specific number of entries (especially useful for pagination).")]),t._v(" "),t._m(17),t._v(" "),a("p",[t._v("Get the second page of results.")]),t._v(" "),t._m(18),t._v(" "),t._m(19),t._v(" "),a("p",[t._v("Requests system can be implemented in custom code sections.")]),t._v(" "),t._m(20),t._v(" "),a("p",[t._v("To extract the filters from an JavaScript object or a request, you need to call the "),a("router-link",{attrs:{to:"./../api-reference/reference.html#strapiutils"}},[a("code",[t._v("strapi.utils.models.convertParams")]),t._v(" helper")]),t._v(".")],1),t._v(" "),t._m(21),t._v(" "),t._m(22),t._v(" "),t._m(23),t._v(" "),t._m(24),t._m(25),t._v(" "),t._m(26),t._v(" "),t._m(27),t._v(" "),t._m(28)])},[function(){var t=this.$createElement,s=this._self._c||t;return s("h1",{attrs:{id:"filters"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#filters","aria-hidden":"true"}},[this._v("#")]),this._v(" Filters")])},function(){var t=this.$createElement,s=this._self._c||t;return s("h2",{attrs:{id:"available-operators"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#available-operators","aria-hidden":"true"}},[this._v("#")]),this._v(" Available operators")])},function(){var t=this.$createElement,s=this._self._c||t;return s("ul",[s("li",[s("a",{attrs:{href:"#filters"}},[this._v("Filters")])]),this._v(" "),s("li",[s("a",{attrs:{href:"#sort"}},[this._v("Sort")])]),this._v(" "),s("li",[s("a",{attrs:{href:"#limit"}},[this._v("Limit")])]),this._v(" "),s("li",[s("a",{attrs:{href:"#start"}},[this._v("Start")])])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h3",{attrs:{id:"filters-2"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#filters-2","aria-hidden":"true"}},[this._v("#")]),this._v(" Filters")])},function(){var t=this,s=t.$createElement,a=t._self._c||s;return a("ul",[a("li",[a("code",[t._v("=")]),t._v(": Equals")]),t._v(" "),a("li",[a("code",[t._v("_ne")]),t._v(": Not equals")]),t._v(" "),a("li",[a("code",[t._v("_lt")]),t._v(": Lower than")]),t._v(" "),a("li",[a("code",[t._v("_gt")]),t._v(": Greater than")]),t._v(" "),a("li",[a("code",[t._v("_lte")]),t._v(": Lower than or equal to")]),t._v(" "),a("li",[a("code",[t._v("_gte")]),t._v(": Greater than or equal to")]),t._v(" "),a("li",[a("code",[t._v("_contains")]),t._v(": Contains")]),t._v(" "),a("li",[a("code",[t._v("_containss")]),t._v(": Contains case sensitive")])])},function(){var t=this.$createElement,s=this._self._c||t;return s("h4",{attrs:{id:"examples"}},[s("a",{staticClass:"header-anchor",attrs:{href:"#example
|