This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymongo import MongoClient | |
import sys | |
client = MongoClient('localhost', 27017) | |
db = client.school | |
score = db.score | |
def find_one(): | |
print "command find_one" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymongo import MongoClient | |
import sys | |
client = MongoClient('localhost', 27017) | |
db = client.school | |
score = db.score | |
def find(): | |
print "command find with selector" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymongo import MongoClient | |
import sys | |
client = MongoClient('localhost', 27017) | |
db = client.reddit | |
stories = db.stories | |
def find(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymongo import MongoClient | |
import sys | |
client = MongoClient('localhost', 27017) | |
db = client.reddit | |
stories = db.stories | |
def find(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymongo | |
import sys | |
client = pymongo.MongoClient('localhost', 27017) | |
db = client.school | |
scores = db.score | |
def find(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymongo | |
import sys | |
client = pymongo.MongoClient('localhost', 27017) | |
db = client.school | |
people = db.people | |
Biagio = {"name": "Biagio", "profession": "student"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymongo import MongoClient | |
import sys | |
import datetime | |
client = MongoClient('localhost', 27017) | |
db = client.school | |
scores = db.score | |
def removeDate(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymongo import MongoClient | |
import sys | |
import datetime | |
client = MongoClient('localhost', 27017) | |
db = client.test | |
things = db.things | |
def using_upsert(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymongo import MongoClient | |
client = MongoClient('localhost', 27017) | |
db = client.test | |
counters = db.counters | |
def get_next_sequence_number(name): | |
counter = counters.find_and_modify(query = {'type': name}, update = {'$inc': {'value': 1}}, upsert = True, new = True) | |
counter_value = counter['value'] |
OlderNewer