0

I'm creating a collection and using localhost but studio 3t doesn't show any tree

I clicked connect tab on studio 3t and made a new connection on it's default (localhost) but when i connect to this new connection the collection that I have created isn't showing on studio 3t

>>> import pymongo
>>> from pymongo import MongoClient
>>> myClient = MongoClient('localhost',username='myusername',password='mypassword')
>>> db = myClient.mydb
>>> users = db.users
>>> user1 = {"username": "nick", "password": "mysecurepass","fav_num": 445, "hobbies": ["python", "games","pizza"]}
>>> user_id = users.insert_one(user1).inserted_id
mohsen
  • 524
  • 5
  • 14
  • You're not connecting a client to a client. That might help you understand what you're doing wrong. – Jazzwave06 Aug 18 '19 at 12:46
  • @sturcotte06 so what should i do?could you help me? – mohsen Aug 18 '19 at 13:18
  • Where is your mongod started? With what options? Can you start the mongo command line on it? – Jazzwave06 Aug 18 '19 at 13:20
  • MongoDB is a network service; by default it will listen on all interfaces (`0.0.0.0`) on port 27017. You should be using standard networking debugging techniques. Is there anything listening on `localhost:27017`? If so, is `pymongo` able to create a client socket on this address? If so, is `studio3t` able to create a client socket on this address? Does `studio3t` have the same `localhost` (is it in a container?). Looking at logs often helps. – Jazzwave06 Aug 18 '19 at 13:29
  • Hello! For this question we would direct you to this entry in the Studio 3T Knowledge Base: https://studio3t.com/knowledge-base/articles/connect-to-mongodb/ It should clear up any questions :) – Studio 3T Aug 19 '19 at 15:26

0 Answers0