我有一个允许用户与其他用户聊天的应用程序,
我只想在每个会话中存储X条消息,并且每条消息必须在创建后的一个月内删除(TTL)
MongoDB支持使用TTL封顶的集合吗?
For additional flexibility when expiring data, consider MongoDB’s TTL indexes, as described in Expire Data from Collections by Setting TTL. These indexes allow you to expire and remove data from normal collections using a special type, based on the value of a date-typed field and a TTL value for the index.
TTL Collections are not compatible with capped collections.
我想不是,那么,还有其他方法可以实现吗?
谢谢