Forcing UID value
-
plugin.getUidByAUid = function(auid, callback) { if (!auid) { return callback(null, 0); } db.sortedSetScore('auid:uid', auid, callback); };
return always null , so i've checked if the function was working and i've try to change db.sortedSetScore('auid:uid', auid, callback) to db.sortedSetScore('email:uid', '[email protected]' , callback) and it work .
At this point i've also checked using redis-cli for 'auid' field, it exist and has the right value.
I really don't understand what's wrong, it look db.sortedSetScore can't find 'auid' for some reason
-
@Simos the equivalent code would be
ZSCORE auid:uid 1
-
@baris so why i can get it in the hash ? auid exist ...
127.0.0.1:6379> HGETALL user:1
- "username"
- "Simos"
- "userslug"
- "simos"
- "email"
- "[email protected]"
- "joindate"
- "1542893552374"
- "lastonline"
- "1543850453258"
- "picture"
- ""
- "fullname"
- ""
- "location"
- ""
- "birthday"
- ""
- "website"
- ""
- "signature"
- ""
- "uploadedpicture"
- ""
- "profileviews"
- "2"
- "reputation"
- "0"
- "postcount"
- "1"
- "topiccount"
- "1"
- "lastposttime"
- "1542893552974"
- "banned"
- "0"
- "status"
- "online"
- "gdpr_consent"
- "0"
- "acceptTos"
- "0"
- "uid"
- "1"
- "password"
- "XXXXXXXXXXXXXXXXXXXXXXXXXX"
- "passwordExpiry"
- "0"
- "groupTitle"
- "["administrators"]"
- "auid"
- "3074"
-
@Simos said in Forcing UID value:
"auid"
"3074"It exists as part of the user hash, but if you don't save it into
auid:uid
thensortedSetScore
will always return null. You need to set it intoauid:uid
as well withdb.sortedSetAdd('auid:uid', uid, auid, callback);
-
@baris i'm losing my self again ... i've already added that value to user hash on user create, in wich part of plugin now i've to save it into auid:uid with the function you have mentioned ?
I'm new to redis ... pheraps i'm confused because i usually use mysql , but i 've understand that is completly different. -
@baris my problem problem is :
how i can call db.sortedSetAdd('auid:uid', uid, auid, callback); on action:user.create ? i don't have uid until user is already created.
@baris said in Forcing UID value:
You need to load the value from the user hash and call db.sortedSetAdd('auid:uid', uid, auid, callback);
i mean some command to do it using redis-cli