Skip to content
Snippets Groups Projects
Commit 34b3c6d5 authored by William Bell's avatar William Bell
Browse files

Correcting the data format

parent e391172f
No related branches found
No related tags found
No related merge requests found
......@@ -22,15 +22,15 @@ orbit_data = db["OrbitData"]
# Print the names of the planets.
print(">> The names of the planets:")
for planet in orbit_data.find({}, {'name': 1, 'Number of Moons': 1, '_id': 0}):
for planet in orbit_data.find({}, {'name': 1, 'n_moons': 1, '_id': 0}):
print(planet)
print()
# Print planets with moons.
print(">> Planets with moons:")
for planet in orbit_data.find({'Number of Moons': {'$gt': 0}},
{'name': 1, 'Number of Moons': 1, '_id': 0}
).sort('Number of Moons'):
for planet in orbit_data.find({'n_moons': {'$gt': 0}},
{'name': 1, 'n_moons': 1, '_id': 0}
).sort('n_moons'):
print(planet)
print()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment