Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Vire · Jan 27, 2014 at 02:46 PM · javascriptfunctiondatabase

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.

Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ArkaneX · Jan 27, 2014 at 02:58 PM 1
Share

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.

avatar image Vire · Jan 27, 2014 at 03:03 PM 0
Share

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.

avatar image KellyThomas · Jan 27, 2014 at 03:24 PM 1
Share

Would $$anonymous$$apReduceOn$$anonymous$$eyList() be more suitable for this task?

avatar image ArkaneX · Jan 27, 2014 at 03:50 PM 1
Share

@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.

avatar image ArkaneX · Jan 28, 2014 at 09:08 AM 1
Share

@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.

Show more comments

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

20 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Need help with enum and stuff (right, left click) in JavaScript 0 Answers

If String is in List Then... 2 Answers

Raycasts don't go the right direction unless i'm really far away (javascript) 1 Answer

Script not function if mouse is on object 1 Answer

How would i make an item database? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges