So i know that in pymongo we create dictionaries to represent documents.
Here is the data I need to store into mongodb
"Dog Snails Zebra Horse Fox".split()
Pet    = [Dog,        Snails,   Fox,          Horse,       Zebra     ]
^^ How would I go about converting either of these into a dictionary so I can store the data in mongoDB?
As I know you have to have the format
emp_rec1 = {
"_id": 1
"name":"Mr.Geek",
"eid":24,
}
But as I only have one key (pets) and many values (dogs, cats, snails, Fox, Horse, Zebra) how would I do this?
In MongoDB, data is stored as documents. These documents are stored in MongoDB in JSON (JavaScript Object Notation) format. So you can insert as {
"pet":[
"Dog",
"Snails",
"Fox",
"Horse",
"Zebra"
]
}
How to insert data into MongoDB (Python, Pymongo)