Forums - C# Corner

Forum guidelines
durgaprasad rapolu

durgaprasad rapolu

  • 1.7k
  • 57
  • 1.3k

How to get the values from MongoDB for user inputs

May 8 2019 1:15 AM
Hi I am creating collection(table) in mongodb like this;
 
DateBase name: Sample
Collection name: Sales 
 
Id : xxxxxxxxxxxxx
India:1,23,456
Usa: 2,34,794
Asia:12,34,689 
 
Now i want to get the values for user inputs dynamically 
 
I am trying this code :
myclient = pymongo.MongoClient("mongodb://localhost:27017/")
mydb = myclient["sample"]
mycol = mydb["sales"]
loc = tracker.get_slot('location') // Inside the location values is India is stored in loc
counterNumber = mycol.count()
gettingTotalSize = mycol.find({}, {"_id": 0, "loc": 1})
for x in gettingTotalSize:
dispatcher.utter_message(str(x["loc"]))
return [] 

Answers (1)