> db.test.insert({a: {b: 1}})
|
WriteResult({ "nInserted" : 1 })
|
> db.test.insert({a: {b: [1]}})
|
WriteResult({ "nInserted" : 1 })
|
> db.test.insert({a: [{b: 1}]})
|
WriteResult({ "nInserted" : 1 })
|
> db.test.insert({a: [{b: [1]}]})
|
WriteResult({ "nInserted" : 1 })
|
>
|
> db.test.aggregate([{$match: {"a.b": 1 }}])
|
{ "_id" : ObjectId("59cd5851ae86cf2464c9b0fb"), "a" : { "b" : 1 } }
|
{ "_id" : ObjectId("59cd5851ae86cf2464c9b0fc"), "a" : { "b" : [ 1 ] } }
|
{ "_id" : ObjectId("59cd5851ae86cf2464c9b0fd"), "a" : [ { "b" : 1 } ] }
|
{ "_id" : ObjectId("59cd5851ae86cf2464c9b0fe"), "a" : [ { "b" : [ 1 ] } ] }
|
>
|
> db.test.aggregate([{$match: {$expr: {$eq: ["$a.b", 1 ]}}}])
|
{ "_id" : ObjectId("59cd5851ae86cf2464c9b0fb"), "a" : { "b" : 1 } }
|
>
|
> db.test.aggregate([{$match: {$expr: {$eq: ["$a.b", [1] ]}}}])
|
{ "_id" : ObjectId("59cd5851ae86cf2464c9b0fc"), "a" : { "b" : [ 1 ] } }
|
{ "_id" : ObjectId("59cd5851ae86cf2464c9b0fd"), "a" : [ { "b" : 1 } ] }
|
>
|
> db.test.aggregate([{$match: {$expr: {$eq: ["$a.b", [[1]] ]}}}])
|
{ "_id" : ObjectId("59cd5851ae86cf2464c9b0fe"), "a" : [ { "b" : [ 1 ] } ] }
|
>
|
> db.test.aggregate([{$match: {$expr: {$or: [ {$eq: ["$a.b", 1 ]}, {$eq: ["$a.b", [1] ]}, {$eq: ["$a.b", [[1]] ]}]}}}])
|
{ "_id" : ObjectId("59cd5851ae86cf2464c9b0fb"), "a" : { "b" : 1 } }
|
{ "_id" : ObjectId("59cd5851ae86cf2464c9b0fc"), "a" : { "b" : [ 1 ] } }
|
{ "_id" : ObjectId("59cd5851ae86cf2464c9b0fd"), "a" : [ { "b" : 1 } ] }
|
{ "_id" : ObjectId("59cd5851ae86cf2464c9b0fe"), "a" : [ { "b" : [ 1 ] } ] }
|