当前位置: 首页>>代码示例>>Python>>正文


Python User.drop_collection方法代码示例

本文整理汇总了Python中models.user.User.drop_collection方法的典型用法代码示例。如果您正苦于以下问题:Python User.drop_collection方法的具体用法?Python User.drop_collection怎么用?Python User.drop_collection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.user.User的用法示例。


在下文中一共展示了User.drop_collection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import drop_collection [as 别名]
    def run(self):

        User.drop_collection()
        Message.drop_collection()

        user1 = User()
        user2 = User()
        user3 = User()
        user4 = User()

        user1.firstName = "John"
        user1.lastName = "Doe"
        user1.birthDate = datetime.now()
        user1.userName = "Creator"
        user1.passHash = user1.userName

        user2.firstName = "Jane"
        user2.lastName = "Doe"
        user2.birthDate = datetime.now()
        user2.userName = "Nemesis"
        user2.passHash = user2.userName

        user3.firstName = "Michelle"
        user3.lastName = "Nielsen"
        user3.birthDate = datetime.now()
        user3.userName = "GoldDigger86"
        user3.passHash = user3.userName

        user4.firstName = "Leif"
        user4.lastName = "Paulsen"
        user4.birthDate = datetime.now()
        user4.userName = "The_Artist"
        user4.passHash = user4.userName

        user1.save()
        user2.save()
        user3.save()
        user4.save()

        message1 = Message()
        message1.subject = "First message"
        message1.text = "This is the first message ever in the system. Hello Jane this is John, how are you?"
        message1.sender = user1
        message1.receiver = user2
        message1.save()

        message2 = Message()
        message2.subject = "Second message"
        message2.text = "This is the second message ever in the system. Hello Jane this is Åge, how are you?"
        message2.sender = user4
        message2.receiver = user2
        message2.save()

        message3 = Message()
        message3.subject = "Second message"
        message3.text = "This is the Third message ever in the system. Hello Jane this is Åge, how are you?"
        message3.sender = user4
        message3.receiver = user1
        message3.save()
开发者ID:Modulus,项目名称:Flask-RestfulDemo,代码行数:61,代码来源:populator.py

示例2: delete_all

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import drop_collection [as 别名]
 def delete_all(cls):
     mongodbmanager.connect()
     User.drop_collection()
开发者ID:B3rs,项目名称:P2P,代码行数:5,代码来源:usersmanager.py

示例3: tearDown

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import drop_collection [as 别名]
 def tearDown(self):
     User.drop_collection()
开发者ID:Modulus,项目名称:FlaskDemo,代码行数:4,代码来源:user_resource_test.py

示例4: clear

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import drop_collection [as 别名]
 def clear(self):
     User.drop_collection()
     Message.drop_collection()
开发者ID:Modulus,项目名称:Flask-RestfulDemo,代码行数:5,代码来源:populator.py

示例5: clear

# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import drop_collection [as 别名]
 def clear(self):
     connect("demo")
     User.drop_collection()
     Message.drop_collection()
开发者ID:Modulus,项目名称:FlaskDemo,代码行数:6,代码来源:generator.py


注:本文中的models.user.User.drop_collection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。