> db.foo.drop()
|
false
|
> db.foo.ensureIndex({a: 1})
|
{
|
"createdCollectionAutomatically" : true,
|
"numIndexesBefore" : 1,
|
"numIndexesAfter" : 2,
|
"ok" : 1
|
}
|
> db.foo.insert({a: 1})
|
WriteResult({ "nInserted" : 1 })
|
> db.foo.insert({a: 2})
|
WriteResult({ "nInserted" : 1 })
|
> db.foo.insert({a: 3})
|
WriteResult({ "nInserted" : 1 })
|
> db.foo.find({}).max({a: 2}).itcount()
|
1
|
> db.foo.find({}).max({a: 2}).count()
|
3 // Unexpected: should return error.
|
> db.foo.find({}).min({a: 2}).itcount()
|
2
|
> db.foo.find({}).min({a: 2}).count()
|
3 // Unexpected: should return error.
|
> db.foo.find({}).maxScan(1).itcount()
|
1
|
> db.foo.find({}).maxScan(1).count()
|
3 // Unexpected: should return error.
|
>
|