- Home /
JS - Return only values matching an ID
I'm retrieving a character list from a database, which requires javascript to work (the rest of the script is in C#) as it uses JSON. I need to basically say only return the values that match the account owner's ID (the character's have that ID stored on them).
This is what I have so far, it returns the entire character list and not ones specific to the account.
private const string GetCharacterListReduceFunction =
@"
function(valueList, keydata, arg) {
return valueList;
}
";
This is what I'm using to call it
private IEnumerator GetInfo()
{
var bucket = new Bucket(bucketName);
var getCharacterListRequest = bucket.MapReduce(new JavaScriptMapPhase(GetCharacterListMapFunction),
new JavaScriptReducePhase(GetCharacterListReduceFunction));
yield return getCharacterListRequest.WaitUntilDone();
_characterEntries = getCharacterListRequest.GetResult<CharacterEntry>();
}
The dilemma here is I code in C# and struggled to get even that working. How can I re-write the code to do what I need it to do? I suppose I have no choice but to familiarize myself with JS, but a little help on this would be nice so I can at least finish up what I'm working on.
How is this related to Unity? You're using some custom solution, and I believe you should seek for an answer in another place.
Additionally, using JSON doesn't mean you have to use JavaScript, because JSON is language independent.
Umm this is related to Unity... You can't just close a post based on your assumption, it's for ugamedb which is for unity.
Would $$anonymous$$apReduceOn$$anonymous$$eyList() be more suitable for this task?
@Vire - I suggest that next time you include a bit more information related to the problem. You mentioned ugamedb in your comments and not in the question itself. Don't assume that all users know each framework or product related to Unity. Having more info, I can reopen your question, though I still believe you can find more info at ugamedb developer page.
@Vire - if you believe that closing your question was wrong, then please contact an ad$$anonymous$$istrator (e.g. Graham Dunnett) via his forum profile. Downvoting my questions as a revenge is a childish behaviour.