Bookshelf.js:避免在调用保存(更新)之后调用fetch调用

问题描述 投票:0回答:1

我们正在将bookshelf.js与MySQL一起使用。

我们有一个表:联系人id, name, email_Id, updated_Contact_At

书架查询:

new Contact({id: 1}).save(
    {name: 'Jhon Snow', email_Id: '[email protected]', birthdate:'1998-10-21'},
    {patch: true, default: false, require: true, method: 'update'}
);

翻译为:

Update Contact set name = "Jhon Snow", 
email_Id = '[email protected]', 
birthdate = '1998-10-21', 
updated_Contact_At = 020-06-08T09:18:10.513Z 
where id = 1;

在执行上述查询书架后,获取了相同的记录:

select Contact.* from Contact where Contact.id = 1 limit 1

[[bookshelf.js中有什么方法可以在更新记录后停止提取调用?

javascript bookshelf.js
1个回答
0
投票
您可以在更新记录时使用autoRefresh = false

new Contact({id: 1}).save( {name: 'Jhon Snow', email_Id: '[email protected]', birthdate:'1998-10-21'}, {patch: true, default: false, require: true, method: 'update', autoRefresh : false} );

使用Bookshelf.js 

version:^ 1.2.0

© www.soinside.com 2019 - 2024. All rights reserved.