Ibm mobilefirst Worklight WL.json存储替换文档失败
我已经初始化了一个集合。因为我有一个保存UserPreferences的文档。我试图更新此文档的几个字段。但是错误回调失败Ibm mobilefirst Worklight WL.json存储替换文档失败,ibm-mobilefirst,Ibm Mobilefirst,我已经初始化了一个集合。因为我有一个保存UserPreferences的文档。我试图更新此文档的几个字段。但是错误回调失败 var dataToUpdate = { userPreferencesID:1, firstname:'Test Name', lastName: 'Test Name 2'};
var dataToUpdate = {
userPreferencesID:1,
firstname:'Test Name',
lastName: 'Test Name 2'};
WL.JSONStore.get(tableName).replace(dataToUpdate).then(successCallback).fail(errorCallback);
如果某个论坛我可以看到语法
WL.JSONStore.get(tableName).replace(查询,选项).then(successCallback).fail(errorCallback)代码>
哪一个是正确的。我尝试了这两种方法,但未能更新记录
IBM Worklight 6.1.0.2版
提前感谢。替换API将JSONStore文档作为第一个参数。例如:
{_id: 1, json: {userPreferencesID: 1, firstname: 'Test Name', lastName: 'Test Name 2'}}
注意\u id
和json
键。您没有将文档作为第一个参数传递
以下是Worklight v6.1中替换API的示例
例如,当您使用findAll
API:
WL.JSONStore.get('collection').findAll()
.then(function (jsonstoreDocuments) {
// [{_id: 1, json: {name: 'carlitos', age: 99}}]
});
上面的示例假定JSONStore集合不是空的,如果它是空的,您将得到一个空数组(即[]
)。replace
API将JSONStore文档作为第一个参数。例如:
{_id: 1, json: {userPreferencesID: 1, firstname: 'Test Name', lastName: 'Test Name 2'}}
注意\u id
和json
键。您没有将文档作为第一个参数传递
以下是Worklight v6.1中替换API的示例
例如,当您使用findAll
API:
WL.JSONStore.get('collection').findAll()
.then(function (jsonstoreDocuments) {
// [{_id: 1, json: {name: 'carlitos', age: 99}}]
});
上面的示例假定JSONStore集合不是空的,如果它是空的,您将得到一个空数组(即[]
)。replace
API将JSONStore文档作为第一个参数。例如:
{_id: 1, json: {userPreferencesID: 1, firstname: 'Test Name', lastName: 'Test Name 2'}}
注意\u id
和json
键。您没有将文档作为第一个参数传递
以下是Worklight v6.1中替换API的示例
例如,当您使用findAll
API:
WL.JSONStore.get('collection').findAll()
.then(function (jsonstoreDocuments) {
// [{_id: 1, json: {name: 'carlitos', age: 99}}]
});
上面的示例假定JSONStore集合不是空的,如果它是空的,您将得到一个空数组(即[]
)。replace
API将JSONStore文档作为第一个参数。例如:
{_id: 1, json: {userPreferencesID: 1, firstname: 'Test Name', lastName: 'Test Name 2'}}
注意\u id
和json
键。您没有将文档作为第一个参数传递
以下是Worklight v6.1中替换API的示例
例如,当您使用findAll
API:
WL.JSONStore.get('collection').findAll()
.then(function (jsonstoreDocuments) {
// [{_id: 1, json: {name: 'carlitos', age: 99}}]
});
上面的示例假定JSONStore集合不是空的,如果它是空的,您将返回一个空数组(即[]
)。您好,谢谢。我得到了它。我完全忘了那部分。接得好。嗨,谢谢。我得到了它。我完全忘了那部分。接得好。嗨,谢谢。我得到了它。我完全忘了那部分。接得好。嗨,谢谢。我得到了它。我完全忘了那部分。抢手货