notion-sdk-js icon indicating copy to clipboard operation
notion-sdk-js copied to clipboard

Reading a "Person" property from a database entry returns only the first result

Open aDogCalledSpot opened this issue 8 months ago • 0 comments

Describe the bug Fetching a "Persons" property from a database entry (e.g. "Assignees") returns only the first person as an object instead of returning a list of people.

Setting the property strangely enough demands a list of people instead of just a single value (which is more in line with the expected behavior).

To Reproduce Node version: ts-node version 10.9.1 Notion JS library version: 2.2.13

Steps to reproduce the behavior:

  • Create a database
  • Add a property "Assignees" of type "Person"
const response = await notion.pages.properties.retrieve({
        page_id: pageId,
        property_id: "Assignees"
    }) as any;
    console.log(response.results);

returns

[
  {
    object: 'property_item',
    type: 'people',
    id: 'Assignees',
    people: { object: 'user', id: 'abcdefdeadbeef123' }
// no array ^-----------------------------------------^
  }
]

Expected behavior

[
  {
    object: 'property_item',
    type: 'people',
    id: 'Assignees',
    people: [{ object: 'user', id: 'abcdefdeadbeef123' }]
// array ---^-------------------------------------------^
  }
]

aDogCalledSpot avatar Dec 04 '23 20:12 aDogCalledSpot