mnfst / manifest

A Whole Backend That Fits Into 1 YAML file. ⭐ to support the project !
https://manifest.build
MIT License
887 stars 51 forks source link

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

Closed RantingHuman closed 4 months ago

RantingHuman commented 5 months 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 5 months ago

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