本文整理汇总了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()
示例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()
示例3: tearDown
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import drop_collection [as 别名]
def tearDown(self):
User.drop_collection()
示例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()
示例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()