0
我为每个用户存储某种类型的ID的同步数组。 在一个网络应用程序中,我有两个功能:addId(id)
和removeId(id)
,我将它们翻译成适当的和synchronizedArray.$remove(getRefForId(id))
。同步数组中的唯一值
在存储我有: 根>用户> $ UID>数据> IDS:synchronizedArray
定义为:
var ref = new Firebase('https://myapp/firebaseio.com/users/' + userUid + '/data/ids');
var synchronizedArray = $firebaseArray(ref);
是否有任何方式来验证的方式这个同步阵列用户不能添加相同的ID多次(换句话说:用户的数据/ ID中的值是唯一的)?
我不希望密钥是唯一的。我需要价值观才是唯一的。 – Ari
没有内置任何内容来确保唯一值,因此您必须更改/扩充数据结构以将这些值转换为密钥。可能类似于[记录在这里的索引](https://www.firebase.com/docs/web/guide/structuring-data.html#section-indices)。 –