This is the path I am going to take due to convenience and the fact that they give you more free requests. If you plan to move the MongoDB location at some point, I would stay with the original solution. Since it would just require changing the credentials at pipedream to repoint everybody to the new Mongo instance.
@adriangomez so I did the first video but I get TIMEOUT when I test the pipedream I re-checked all my work and its the same as on your video but I got TIMEOUT..
what do you mean what username and password? username with English letters and password with letters and numbers.
I want to send and receive unique tables to users.
if it can be done with this methods it will be amazing and will solve me a lot of issues.
thanks
adent42Key Master, Head Chef, Executive Chef, Member, PROPosts: 3,129
I think @adriangomez might be asking what system are they logging in and out of? Do you want to manage your own user database or are yo looking to using some other 3rd party authentication system?
@nir3112 To fix the issue you are seeing with the MacCreator, I just updated the script so you can pass the document name. For others reading this, sometimes the table name is not passed from GameSalad (in MacCreator). In my original script, I used the table name value to store the table. Now you can explicitly specify the table name you are saving via the query string.
@adriangomez Hi. I looked at tutorials today and seems Realm is now App Services. Would you be able to post an update to indicate the options needed to get the same result? Thanks.
I've set up using realm & mongodb (following your third tutorial). I am successfully writing tables to the mongo database from gamesalad :)
however, i am getting -1 request status when using the load table / get function. I think I must have missed something.
the logs on mongodb show that the function is executing without errors, but i don't see any parsed database data in the logs there. (when i am saving / posting, i see the JSON data from gamesalad tables in the logs) -- so maybe it's a problem with my syntax?
I've added a screenshot of my document -- the document name here is stringtst, correct? So my URL would be <url>?documentName=stringtst&collection=game
or should i be using the tableid for the name? (id137218)
Appreciate any insight here. I'll continue to toy with it.
looks like i have found success... I changed some code in the GET function. I added async and await, that resolved my -1 error and things seem to be talking. Here's the code in case anyone needs (change application-0 to your database name):
Comments
Part 2: Retrieving the table.
@adriangomez you are simply awesome. I will go through this and see how I go. Thank you so much!
Part 3: Using Mongo Realm instead of Pipedream.
This is the path I am going to take due to convenience and the fact that they give you more free requests. If you plan to move the MongoDB location at some point, I would stay with the original solution. Since it would just require changing the credentials at pipedream to repoint everybody to the new Mongo instance.
@adriangomez I soooo love you right now! thank you!!
there is some way to create login, register and logout with this methods?
@adriangomez so I did the first video but I get TIMEOUT when I test the pipedream I re-checked all my work and its the same as on your video but I got TIMEOUT..
any idea what can be the problem?
thanks[=
sorry I forgot something now its working '^_^
I can see if I can incorporate login/logout. What username and password are they using?
great thanks [=
what do you mean what username and password? username with English letters and password with letters and numbers.
I want to send and receive unique tables to users.
if it can be done with this methods it will be amazing and will solve me a lot of issues.
thanks
I think @adriangomez might be asking what system are they logging in and out of? Do you want to manage your own user database or are yo looking to using some other 3rd party authentication system?
Yes exactly what I am asking.
oh ok.. I want it to be like it was on Gamesparks. (I'm not sure what kind of authentication it was exactly)
the user put the user name and password and hit login, then is sends to the server, confirm the data, run the login code and log him in.
I hope I understand the question😅
thanks for the clarification @adent42
@nir3112 To fix the issue you are seeing with the MacCreator, I just updated the script so you can pass the document name. For others reading this, sometimes the table name is not passed from GameSalad (in MacCreator). In my original script, I used the table name value to store the table. Now you can explicitly specify the table name you are saving via the query string.
<URL>?documentName=<tableName>&collection=<collectionName>
@nir3112 Fixed: The save table script now correctly switches the value to 1 when successful. I updated the script:
https://gist.github.com/agramonte/d1c9cdaad44232bf50f8c4fdfcc900d9
As requested: Part 4 shows how to use a JSON object to store username/password for authentication.
https://youtu.be/HY5WPBydg9A
thanks! Already tried that and it’s working[=
Last in the series. Just tying up some loose ends.
Thank you for this. It's exactly what I was looking for to play around with.
@adriangomez Hi. I looked at tutorials today and seems Realm is now App Services. Would you be able to post an update to indicate the options needed to get the same result? Thanks.
@Chris Fitsimons Nothing has changed. It is still the same—just the names. Sorry, I just noticed this old comment.
@nir3112 As requested, I have posted the code I use for using a GUID per user that can be displayed to the user if needed.
Here is what it looks like on my game:
@adriangomez you are a Rock Star!
Hardly @adent42, but thank you anyway.
Thanks for the wonderful resource.
I've set up using realm & mongodb (following your third tutorial). I am successfully writing tables to the mongo database from gamesalad :)
however, i am getting -1 request status when using the load table / get function. I think I must have missed something.
the logs on mongodb show that the function is executing without errors, but i don't see any parsed database data in the logs there. (when i am saving / posting, i see the JSON data from gamesalad tables in the logs) -- so maybe it's a problem with my syntax?
I've added a screenshot of my document -- the document name here is stringtst, correct? So my URL would be <url>?documentName=stringtst&collection=game
or should i be using the tableid for the name? (id137218)
Appreciate any insight here. I'll continue to toy with it.
Digging further... the response from the HTTPS get request is: {} when using https://us-east-1.aws.data.mongodb-api.com/app/application-0-hrlqu/endpoint/app1/gsget?collection=game&documentName=stringtst (can click on the link and see) -- which means the function isn't returning the JSON data, i think.. so maybe it's a problem with my document names or collections?
looks like i have found success... I changed some code in the GET function. I added async and await, that resolved my -1 error and things seem to be talking. Here's the code in case anyone needs (change application-0 to your database name):
exports = async function(payload, response) {
const {documentName, collection} = payload.query;
var filter = {};
filter["Name"] = documentName;
// const doc = await context.services.get("mongodb-atlas").db("application-0").collection(collection).find().toArray()
const doc = await context.services.get("mongodb-atlas").db("application-0").collection(collection).findOne(filter);
response.setStatusCode(200);
response.setBody(await JSON.stringify(doc));
};