续集节点表达 javascript

sequelize node express javascript

大家好,每当我使用此查询时,我都会使用带有 sequelize 的 node-express,我得到的计数不正确。 Tabel 产品在返回计数 3 时包含一个产品。 代码如下

let product = await model.Product.findAndCountAll({
    where:condition, 
    attributes:['id' , 'product_name' , 'description' , 'model_information' , 'brand', 'ProductWarrenty' , 'WarrentyDuration' , [price ,'price']],
    include:[{
      model:model.Category,as:'productcategory'
      
    } , {
      model:model.SubCategory, as:'ProductSubCategory'
    } , {
      model:model.ProductImages,as:'product_images'
    }],
    offset: offset,
      limit: 14,
      order: [sorting]
  })

产品 table 有 1 条记录,但返回 3 条记录。

yeah i solved it.
use two properties
    unique:true,
    distinct:true,
use this query 

et product = await model.Product.findAndCountAll({
        where:condition, 
distinct:true,
unique:true,
        attributes:['id' , 'product_name' , 'description' , 'model_information' , 'brand', 'ProductWarrenty' , 'WarrentyDuration' , [price ,'price']],
        include:[{
          model:model.Category,as:'productcategory'
          
        } , {
          model:model.SubCategory, as:'ProductSubCategory'
        } , {
          model:model.ProductImages,as:'product_images'
        }],
        offset: offset,
          limit: 14,
          order: [sorting],
      })
yes i also solved it 
use unique:true 
Product.findAndCountAll({
        where:condition, 
distinct:true,
unique:true,
})