如何获取MongoDB属性的最后一个值?

如何获取MongoDB属性的最后一个值?,mongodb,mongoose,mongodb-query,mongoid,Mongodb,Mongoose,Mongodb Query,Mongoid,我正在尝试恢复已更改的MongoDB集合上的数据 即-property:false->true,我没有整个集合的备份 有没有办法知道$set操作之前的最后一个属性值是什么?比如对数据的操作历史 它也可以基于时间戳 示例:集合名称Users 更改前: {name:"xxxx1", address:"yyyy1", test:false} {name:"xxxx2", address:"yyyy2", test:true} {name:"xxxx3", address:"yyyy3", test:f

我正在尝试恢复已更改的MongoDB集合上的数据

即-property:false->true
,我没有整个集合的备份

有没有办法知道
$set
操作之前的最后一个属性值是什么?比如对数据的操作历史

它也可以基于时间戳

示例:集合名称
Users

更改前:

{name:"xxxx1", address:"yyyy1", test:false}
{name:"xxxx2", address:"yyyy2", test:true}
{name:"xxxx3", address:"yyyy3", test:false}
{name:"xxxx4", address:"yyyy4", test:true}
变更后:

{name:"xxxx1", address:"yyyy1", test:true}
{name:"xxxx2", address:"yyyy2", test:true}
{name:"xxxx3", address:"yyyy3", test:true}
{name:"xxxx4", address:"yyyy4", test:true}
我想知道所有具有值的实体
test:false

{name:"xxxx1", address:"yyyy1", test:false}
{name:"xxxx3", address:"yyyy3", test:false}

可能吗?

除非在此更新操作之前在集合上安装了一些版本控制插件,否则无法提取更改。但是,您可能需要查看哪个是一个有上限的集合,它存储了对MongoDB数据库的逻辑写入的有序历史记录