Sign In Register

How can we help you today?

Start a new topic

RE: allow pre-population of gs-query fields

I submitted https://support.gamesparks.net/support/discussions/topics/1000065784 which has now been closed, otherwise I would continue the conversation there.


I am really eager to start using this feature and attempted to integrate it immediately, however, I am seeing challenges in how to use this feature.


When I create a query with an existing gs-query element, of say XP >= 10 and Level <= 10 I get a data object in the submission of {"XP":{"$gte":10},"level":{"$lte":10}} which is usable in my mongo queries

if I as for XP  <= 20 OR level <= 20 I get {"$or":[{"XP":{"$lte":20}},{"level":{"$lte":20}}]} which again, is usable in my mongodb queries.


Now I try to push these same data objects into the 'rules' parameter of my gs-query and I'm going to have to completely reformat the query object in order for it to work... I'm not sure if it's possible, but could the superfluous content be removed from the required data structure so that I can just pass in the valid mongodb request to the rules section of the gs-query.


Also I noticed the documentation is not updated as yet.


Hello Arnold V,


Our Query builder will not recognise mongoDb queries directly, we do however provide you with correctly formatted object which will be understood by the Query builder. To reiterate, when submitting the gsUserQuery in a form you will actually submit 2 values: 

// mongoDb readable
"gsUserQuery":{"displayName":"test"}

// queryBuilder readable
"gsUserQuery-raw":{"condition":"AND","rules":[{"id":"displayName","field":"displayName","type":"string","input":"text","operator":"equal","value":"test"}]}

The final step into making the gsUserQuery-raw readable by the Query builder is to JSON.stringify() it in the javaScript section (refer to my previous answer). Unfortunately there isn't an easy way to convert the mongoDb readable query into our Query builder readable one, without sacrificing accuracy.


I will update our documentation to reflect this, let me know if this helped you.


Regards,


Mantas

Yes, this now makes sense, that you are providing two different values. I should be able to move forward with that information, thank you.

Login to post a comment