NOÉ is searching for a volunteer dev ! Interested ? Send an email to hello@noe-app.io.
Skip to main content

Filtering

The NOÉ API filtering system allows applying advanced filters on LIST endpoints using a syntax inspired by MongoDB.

📋 Overview

Filtering works on all LIST endpoints of the API using the filter parameter in the URL.

⚠️ Limitations

Only ObjectIds can be filtered for references. Properties of related objects are not accessible.

  • ✅ Valid: filter={"category":"507f1f77bcf86cd799439011"}
  • ❌ Invalid: filter={"category.name":"Accueil"}
  • ❌ Invalid: filter={"user.email":"@gmail.com"}

Filterable Field Types

Field TypeExampleFilterable
Direct fieldsname, email, createdAt✅ Yes
ObjectId referencescategory, user, activity✅ By ID only
Properties of related objectscategory.name, user.email❌ No
Custom fieldscustomFields.field1✅ Yes

🚀 Supported Endpoints

All LIST endpoints support filtering.

Projects

  • GET /projects - Projects
  • GET /projects/public - Public projects

Per Project

  • GET /projects/:projectId/activities - Activities
  • GET /projects/:projectId/categories - Categories
  • GET /projects/:projectId/places - Spaces
  • GET /projects/:projectId/sessions - Sessions
  • GET /projects/:projectId/stewards - Supervisors
  • GET /projects/:projectId/teams - Teams
  • GET /projects/:projectId/registrations - Registrations

📖 Syntax and Examples

You must use a JSON format directly in the URL:

GET /projects/:projectId/activities?filter={"name":{"$regex":"atelier","$options":"i"},"tags":{"$in":["musique","art"]}}

🔧 Supported Operators

OperatorDescriptionExample
$eqEqual tofilter={"name":{"$eq":"Atelier"}}
$neNot equal tofilter={"status":{"$ne":"cancelled"}}
$gtGreater thanfilter={"age":{"$gt":18}}
$gteGreater than or equalfilter={"age":{"$gte":18}}
$ltLess thanfilter={"price":{"$lt":100}}
$lteLess than or equalfilter={"price":{"$lte":100}}
$inContained in the arrayfilter={"status":{"$in":["active","pending"]}}
$ninNot contained in the arrayfilter={"status":{"$nin":["cancelled","archived"]}}
$regexRegular expressionfilter={"name":{"$regex":"^ate"}}
$optionsRegex optionsfilter={"name":{"$regex":"workshop","$options":"i"}}
$existsField existsfilter={"description":{"$exists":true}}
$allContains all valuesfilter={"tags":{"$all":["music","art"]}}
$sizeArray sizefilter={"slots":{"$size":3}}

🔄 Filter Combination

Multiple filters can be combined in the same request:

# Simple combination
GET /projects/:projectId/activities?filter={"active":true,"name":{"$regex":"atelier"}}

# Complex combination
GET /projects/:projectId/sessions?filter={"start":{"$gte":"2024-01-01"},"end":{"$lt":"2024-12-31"}}

📅 Date Format

Dates must be in ISO 8601 format:

# Full format
GET /projects/:projectId/sessions?filter={"start":{"$gte":"2024-01-01T00:00:00.000Z"}}

# Simple date format
GET /projects/:projectId/sessions?filter={"start":{"$gte":"2024-01-01"}}
GET /projects/:projectId/sessions?filter={"start":{"$gte":"2024"}}

🎯 Examples by Entity Type

Activities

# Activities by name
GET /projects/:projectId/activities?filter={"name":{"$regex":"atelier","$options":"i"}}

# Activities by category (ID)
GET /projects/:projectId/activities?filter={"category":"507f1f77bcf86cd799439011"}

# Activities with specific tags
GET /projects/:projectId/activities?filter={"tags":{"$in":["musique","art"]}}

Sessions

# Sessions by name
GET /projects/:projectId/sessions?filter={"name":{"$regex":"matin"}}

# Sessions by activity (ID)
GET /projects/:projectId/sessions?filter={"activity":"507f1f77bcf86cd799439011"}

# Sessions after a date
GET /projects/:projectId/sessions?filter={"start":{"$gte":"2024-01-01"}}

Registrations

# Registrations by role
GET /projects/:projectId/registrations?filter={"role":"admin"}

# Registrations by user (ID)
GET /projects/:projectId/registrations?filter={"user":"507f1f77bcf86cd799439011"}

# Registrations subscribed to a certain session (ID)
GET /projects/:projectId/registrations?filter={"sessionsSubscriptions.session": "68dacf51c55364e0b89d45ce"

# Registrations created after a date
GET /projects/:projectId/registrations?filter={"createdAt":{"$gte":"2024-01-01"}}

# Registrations by steward (ID)
GET /projects/:projectId/registrations?filter={"steward":"507f1f77bcf86cd799439011"}

Spaces

# Spaces by capacity
GET /projects/:projectId/places?filter={"maxNumberOfParticipants":{"$gte":50}}

# Spaces by name
GET /projects/:projectId/places?filter={"name":{"$regex":"bar"}}

🛡️ Security and Limitations

Blocked Operators

The following dangerous operators are blocked for security reasons:

  • $where
  • $near
  • $geoWithin
  • $geoIntersects

Limitations

  • Maximum regex pattern length: 500 characters
  • Maximum array size: 100 elements
  • Strict parameter validation before execution