FIND Examples
From NoSQLZoo
Introducing the world
collection of countries
These examples introduce NoSQL using MonogDB and PyMongo. We will be using the find() command on the collection world:
This example shows how to find the population of a country by searching it's name then limiting what fields are returned.
SELECT population FROM world WHERE name = 'France'
Show the population of France
from pymongo import MongoClient # Import pymongo client = MongoClient() # Use the default client settings ('mongodb://localhost:27017/') client.progzoo.authenticate('scott','tiger') # Log in as "Scott" with the password "Tiger" db = client['progzoo'] # Use the "progzoo" database print list(db.world.find({"name":"France"},{"population":1, "_id":0}))
console.log("Hello World");