Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Contribute to GitLab
  • Sign in
P
pymongo
  • Project
    • Project
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • docker101
  • pymongo
  • Repository

Switch branch/tag
  • pymongo
  • db
  • mongo.py
Find file
BlameHistoryPermalink
  • Ahmad Anvari's avatar
    Change methods of base model class · 887fbe1c
    Ahmad Anvari authored 5 years ago
    887fbe1c
mongo.py 459 Bytes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
from abc import ABC, abstractmethod
from pymongo import MongoClient

client = MongoClient()


class Model(ABC):

    @staticmethod
    def get_db():
        return client['shoppe']

    @abstractmethod
    def store(self):
        pass

    @staticmethod
    @abstractmethod
    def get_collection():
        pass

    @staticmethod
    @abstractmethod
    def dict_to_object(dictionary):
        pass

    @abstractmethod
    def to_dict(self):
        pass

Replace mongo.py

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.