如何使用吗啡在mongo中的文档中设置TTL?

时间:2018-10-26 11:21:12

标签: java mongodb indexing morphia database-indexes

当前在morphia中使用以下代码在文档上具有ttl索引。

Traceback (most recent call last):
  File "my_script.py", line 226, in <module>
    main()
  File "my_script.py", line 207, in main
    driver = set_pref(path)
  File "my_script.py", line 44, in set_pref
    return webdriver.Firefox(firefox_profile=profile)
  File "/home/krupa/.local/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 174, in __init__
    keep_alive=True)
  File "/home/krupa/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/krupa/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/krupa/.local/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/krupa/.local/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: newSession

但是我收到以下错误。 线程“主” org.mongodb.morphia.mapping.MappingException中的异常:无法针对“ com.example.productdils.ProductDeils”解析路径“。

有人可以帮忙吗?

PS:我知道使用mongodb java客户端是如何完成的。但是我的应用程序是利用吗啡。

1 个答案:

答案 0 :(得分:0)

您没有指定要对初学者应用ttl的字段。也许您只是为了简洁起见省略了这些字段,但您当然需要它们来定义针对的索引