You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it.only("should keep an `undefined` attribute unchanged if the attribute is absent from the upsert body",function*(){constmockPost=postGen(1,null).pop()const{ _id, content, created }=mockPost// 需要先有这个条目才能复现原来 undefined 的属性被改为 null 的行为。yielddatabase.upsert('Post',{ _id, created })constpost={ _id, content }constexecRet=yielddatabase.update('Post',post)// upsert 也能重现,insert 不会const[ret]=yielddatabase.get<PostSchema>('Post',{where: {_id: post._id,},}).values()expect(ret).to.deep.equal({ _id, content, created })checkExecutorResult(execRet,1)})
实际发生的场景:
受到影响的那个字段是 OBJECT 类型
raw
参数只包含主键和一个与受影响字段无关(不存在关联)的字段手动 upsert
{ 主键: 'xxx', 受影响字段: undefined }
,可以将该字段值重置为 undefined构建一个失败的单元测试以确认问题
在 test/schemas/Post 里,添加 attachments 字段,设置其类型为 RDBType.OBJECT,
得:
The text was updated successfully, but these errors were encountered: