'Sequelize id (pk) column invalid value

I have here a where condition in which I need to find things that are not equal to the ID field (primary key) of the staff members table,

however for some reason when the program returns the promise it tells me 'Invalid value { id: 1 }'

id is the name of the column in the db, and there is an entry associated with the value.

The comments are the older code from sequalize 3 being ported to 6.

exports.getAllStaffMembers = async (request, reply) => {
  const attributes = ['id', 'accessLevel', 'emailAddress', 'firstName', 'lastName', 'phoneNumber', 'profilePictureHash'];
  let where = {
    [Op.ne]: [{ id: request.auth.credentials.id }]
  }
  // `"staffMember"."id" <> ${request.auth.credentials.id}`;

  if (request.query.rank) {
    where[Op.and] =
    {
      accessLevel: request.query.rank
    }

    // where = `${where} AND (1
    //   "staffMember"."accessLevel" = '${request.query.rank}'
    // )`;
  }

  const staffMembers = await model.staffMember.findAndCountAll(_.assign({},
    requestHelper.computePaginationObject(request.query.limit, request.query.page), {
    attributes,
    where: [where],
    order
  }));

what am I doing wrong / how do I use the values in the primarykey id column?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source