db.questions.insert_one({'What':'really','goes':'into','a':'peep','?':'!'}) db.questions.insert_one({'or':'for','that':'matter','a':'starburst','!':'?'}) db.baskets.insert_many([{ 'child':'Stacy', 'age':9, 'chocolates': { 'kisses':4, 'reeses':6, 'kit kats':2 }, 'non-chocolates': { 'jelly beans':24, 'peeps':12 }, 'extras' : [ 'daisies', 'costume jewelry', 'chapstick', 'wristband' ] }, { 'child':'Timmy', 'age':9, 'chocolates': { 'kisses':6, 'kit kats':4 }, 'non-chocolates': { 'jelly beans':30, 'peeps':4, 'warheads':4 }, 'extras' : [ 'water pistol', 'action figure', 'deodorant' ] }]) db.truths.insert_one({ 'a': 'He is risen!', 'b': 'He is risen indeed!' }) db.questions.insert_many([{'Where':'do'}, {'they':'grow'}, {'fake':'grass'}]) db.baskets.insert_one({ 'child':'Goofus', 'age': 13, 'chocolates': { 'kit kats':12, 'three musketeers':4 }, 'non-chocolates': { 'licorice':8, 'starburst':12 }, 'extras' : [ 'puzzle book', 'ninja star', 'flashlight', 'chapstick' ] }) db.questions.insert_many([ {'Are':'jelly', 'beans':'really'}, {'made':'out', 'of':'jelly'}]) sunrise = db.questions.count_documents( {'$or':[{'fake':{'$exists':0}}, {'beans':{'$exists':1}},{'jelly':{'$exists':1}}]}) lily = list(db.questions.find( {'or':{'$exists':1}}).skip(0).limit(1)) bunny = db.truths.find().next()['b'][9] lily = lily[0]['a'][0:4] sunday = list(db.baskets.aggregate([ {'$group':{'_id':'$age','morning':{'$avg':'$chocolates.kit kats'}}}, {'$sort':{'_id':-1}}])) service = sunday[-1]['morning'] morning = db.baskets.find({'extras':'chapstick'}).sort([('age',-1)]).next() spring = morning['extras'][int(sunrise)-int(service)][1:4] breeze = db.questions.find({'?':{'$exists':1}}).next()['a'][0:3] print(f"{spring}{breeze} {bunny}-{lily}")