Connecting to MongoDB

I feel like a 2 or 3 minute video would be very helpful for this. Iā€™m spending hours on this and still no luck. Like where do you put the python script query? in the database api?

there is such a small amount of official documentation on this compared to some other topics. one little paragraph and a couple forum posts

The python script you can run it locally after you whitelisted your public IP. You can use any other language to connect to mongo db. Or any other tool.

ok when i try to add an ip for whitelist and hit save it doesnā€™t do anything

Try a logout and login again

I also keep getting an ā€œerror sycning plugins: invaled token requestā€

awesome! i was able to add an IP. now to figure out what the issue is nowā€¦

i type import pprint locally and get error

What error? Did you install python?

Yes I have downloaded and installed. Not sure what if I need to type any more prompts to fully install the package. it says ā€œimportā€ is not recognized aha

I was supposed to go to mongo website and make a cluster, correct? Or was that part unnecessary?

what do you want to do? you donā€™t need necessarily to go to mongo website if you only want to connect to mongo db

i want to view and manipulate the data. add counter columns

ok, it may be easier to use Moralis SDK directly, look in dashboard interface, if you donā€™t have too much experience in programming

1 Like

it says reference admin settings for host and port, but all i see is IP. I assume thatā€™s one of the two

Alright I am now connected on python! The example query just returns one item, not what iā€™m looking for exactly. But very glad to have figured out the connection part!

its coming along nicely now! i can understand why you couldnā€™t explain it all. many troubleshooting that one must do one their own

1 Like

It should be easy. Help! What is the connect string you had to use?? (You can disguise your host and username and password) Mongo is almost impossible to figure out how to connect, even in non-Moralis applications. I tried everything, even whitelisted my ip address, and I tried various permutations of a mongo connect string like this

mongodb://USERNAME:PASSWORD@HOSTIP:HOSTPORT/?directConnection=true&tls=true&authMechanism=DEFAULT

I found out how to use the Database functions directly so I could avoid using Mongo directly.

Itā€™s here, the only place I found out the secret: https://v1docs.moralis.io/moralis-dapp/connect-the-sdk/connect-using-node

You donā€™t have to set any username and password, only the IP