Arrays 如何$unwind并包含原始数组中的索引

Arrays 如何$unwind并包含原始数组中的索引,arrays,mongodb,Arrays,Mongodb,我正在尝试以下方法: db.c1.aggregate([{$unwind: "$arr"}]) 这个很好用。但是,我希望包含数组的索引,并尝试: 这将产生以下错误: assert: command failed: { "errmsg" : "exception: the $unwind field path must be specified as a string", "code" : 15981, "ok" : 0 } : aggregate

我正在尝试以下方法:

db.c1.aggregate([{$unwind: "$arr"}])
这个很好用。但是,我希望包含数组的索引,并尝试:

这将产生以下错误:

assert: command failed: {
        "errmsg" : "exception: the $unwind field path must be specified as a string",
        "code" : 15981,
        "ok" : 0
} : aggregate failed
Error: command failed: {
        "errmsg" : "exception: the $unwind field path must be specified as a string",
        "code" : 15981,
        "ok" : 0
} : aggregate failed
    at Error (<anonymous>)
    at doassert (src/mongo/shell/assert.js:11:14)
    at Function.assert.commandWorked (src/mongo/shell/assert.js:254:5)
    at DBCollection.aggregate (src/mongo/shell/collection.js:1278:12)
    at (shell):1:7
2016-04-16T18:37:38.100+0000 E QUERY    Error: command failed: {
        "errmsg" : "exception: the $unwind field path must be specified as a string",
        "code" : 15981,
        "ok" : 0
} : aggregate failed
    at Error (<anonymous>)
    at doassert (src/mongo/shell/assert.js:11:14)
    at Function.assert.commandWorked (src/mongo/shell/assert.js:254:5)
    at DBCollection.aggregate (src/mongo/shell/collection.js:1278:12)
    at (shell):1:7 at src/mongo/shell/assert.js:13

您是否有可能有一个MongoDB版本<3.2?同样的情况也发生在我身上,它是MongoDB版本。我用的是3.0.3。
assert: command failed: {
        "errmsg" : "exception: the $unwind field path must be specified as a string",
        "code" : 15981,
        "ok" : 0
} : aggregate failed
Error: command failed: {
        "errmsg" : "exception: the $unwind field path must be specified as a string",
        "code" : 15981,
        "ok" : 0
} : aggregate failed
    at Error (<anonymous>)
    at doassert (src/mongo/shell/assert.js:11:14)
    at Function.assert.commandWorked (src/mongo/shell/assert.js:254:5)
    at DBCollection.aggregate (src/mongo/shell/collection.js:1278:12)
    at (shell):1:7
2016-04-16T18:37:38.100+0000 E QUERY    Error: command failed: {
        "errmsg" : "exception: the $unwind field path must be specified as a string",
        "code" : 15981,
        "ok" : 0
} : aggregate failed
    at Error (<anonymous>)
    at doassert (src/mongo/shell/assert.js:11:14)
    at Function.assert.commandWorked (src/mongo/shell/assert.js:254:5)
    at DBCollection.aggregate (src/mongo/shell/collection.js:1278:12)
    at (shell):1:7 at src/mongo/shell/assert.js:13
{ "_id" : ObjectId("57127e0475026f0d7a8339c9"), "arr" : [ { "val" : 5, "time" : ISODate("2016-04-16T18:01:40.833Z") }, { "val" : 5, "time" : ISODate("2016-04-16T18:03:52.503Z") }, [ { "val" : 99, "time" : ISODate("2016-04-16T18:04:17.637Z") } ] ] }