mnfst / manifest

Effortless backends ✨
https://manifest.build
MIT License
460 stars 23 forks source link

The "filter by relations" syntax provided in the SDK documentation does not appear to work #127

Closed RantingHuman closed 1 day ago

RantingHuman commented 1 week ago

Describe the bug In the Javascript SDK documentation, an example is given on how to filter entities by relation:

// Filter by relations.
const cats = await manifest
  .from('cats')
  .where(`owner in 1,2,3`)
  .andWhere(`store = ${storeId}`)
  .find()

However, this syntax appears to be incorrect. For instance, if I were to run the following code:

const cats = await manifest
      .from('cats')
      .where('owner in 1,2,3')
      .find();

I get the error:

{ statusCode: 400, message: 'Property owner does not exist in Cat' } 

Attempting to load the relations beforehand also does not appear to fix the issue:

    const cats = await manifest
      .from('cats')
      .with(['owner'])
      .where('owner in 1,2,3')
      .find();

To Reproduce Steps to reproduce the behavior:

  1. Install the default Manifest backend
  2. Install the Manifest SDK
  3. Run the above code to filter Cats by owner

Expected behavior A list of Cats filtered by the Owner should be returned

Code snippets

const cats = await manifest
      .from('cats')
      .where('owner in 1,2,3')
      .find();
github-actions[bot] commented 1 week ago

Welcome to Manifest, thank you for adding your first issue !