MongoDB连续文档的字段值之间的差异

时间:2018-12-17 18:57:23

标签: mongodb

{date:"2018-12-17-11.49.01.829874",server:"aghf580",instance:"pddd700-ipc1",commit_Count:300,connection:100}
{date:"2018-12-17-11.50.01.829874",server:"aghf580",instance:"pddd700-ipc1",commit_Count:400,connection:150}
{date:"2018-12-17-11.51.01.829874",server:"aghf580",instance:"pddd700-ipc1",commit_Count:550,connection:220}
{date:"2018-12-17-11.52.01.829874",server:"aghf580",instance:"pddd700-ipc1",commit_Count:750,connection:300}

因此,我每1分钟有一些数据指标。在本文档中,我没有几个字段,每个字段都在增加。我的目标是获取Mongo DB中同一字段的2个连续文档之间的值差。

所需的输出:

{date:"2018-12-17-11.49.01.829874",server:"aghf580",instance:"pddd700-ipc1",commit_Count:300,connection:100}
{date:"2018-12-17-11.50.01.829874",server:"aghf580",instance:"pddd700-ipc1",commit_Count:100,connection:50}
{date:"2018-12-17-11.51.01.829874",server:"aghf580",instance:"pddd700-ipc1",commit_Count:150,connection:70}
{date:"2018-12-17-11.52.01.829874",server:"aghf580",instance:"pddd700-ipc1",commit_Count:200,connection:80}

0 个答案:

没有答案