Skip to content

Instantly share code, notes, and snippets.

@NMZivkovic
Created November 1, 2019 12:24
Show Gist options
  • Save NMZivkovic/8d08ea593b8cd47c856bc4ed58f95d00 to your computer and use it in GitHub Desktop.
Save NMZivkovic/8d08ea593b8cd47c856bc4ed58f95d00 to your computer and use it in GitHub Desktop.
class UserRepository(object):
def __init__(self):
mongoclient = MongoClient('localhost', 27017)
#mongoclient = MongoClient('mongodb://localhost:27017')
database = mongoclient.local
self._users = database.user
# Create operations
def insert(self, user):
return self._users.insert_one(user)
def insert_many(self, users):
return self._users.insert_many(users)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment