我的 Parse Server 类中有一个指针字段。我正在尝试使用 Javascript API 在指针中写入链接类字段的 objectId。这是我的功能:
$scope.createItem = function (user, product) {
var Item = Parse.Object.extend("II"),newII = new Item();
newII.set("product", product);
var acl = new Parse.ACL();
acl.setPublicReadAccess(false);
acl.setPublicWriteAccess(false);
acl.setReadAccess(Parse.User.current(), true);
acl.setWriteAccess(Parse.User.current(), true);
// This doesn't work
newII.set({
"__type": "Pointer",
"shop": "dklJ4Oaf2B"
});
newII.set("QTY", $scope.qtyCount);
newII.save();
};
ACL 和 QTY 字段(数字)毫无问题地写入数据库,但是指针字段(名为“shop”)未填充。
最佳答案
不要“手动”编写您认为指针应该是什么样子的代码,使用 SDK 为您完成!
var shop = new ParseObject('Shop');
shop.id = 'dklJ4Oaf2B';
var newII = new Item();
newII.set('shop', shop);
newII.save()
关于javascript - 解析服务器 Javascript API 发布到指针,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47631884/