Skip to main content

findFirst()

Used to retrieve the first row matching specific conditions.

Available Keys

KeyDescriptionOptionalNotes
whereSpecifies query conditionsOptionalRetrieves all rows if omitted
selectDisplay settings for columnsOptionalCannot be used with omit / include. Supports relation field options
omitExclusion settings for columnsOptionalCannot be used with select
includeRetrieve related recordsOptionalDetails here
orderBySort settingsOptionalArray can be omitted when specifying a single column
cursorCursor-based paginationOptionalSee findMany cursor for details

Example Sheet

Example Sheet

Description

Suppose you want to retrieve a row from the above example with the following condition:

  • age => 20 or older

The code would be:

const gassma = new Gassma.GassmaClient();

// gassma.{{TARGET_SHEET_NAME}}.findFirst
const result = gassma.sheet1.findFirst({
where: {
age: {
gte: 20,
},
},
});

The return value has the following format:

{
name: 'akahoshi',
age: 22,
pref: 'Ibaraki',
postNumber: '310-8555'
}

For key options and other specifications, see findMany().