Hello Joe,
thanks for the reply.
I run ‘db.collection.find(…)’ and got the results. The performance was strictly bettere than the ToList()
I also run the ‘db.collection.find().explain()’ and this is the result:
{
queryPlanner: {
plannerVersion: 1,
namespace: 'FirstCollection.Pokemon',
indexFilterSet: false,
parsedQuery: { 'moves.name': { '$eq': 'thunder' } },
winningPlan: {
stage: 'FETCH',
inputStage: {
stage: 'IXSCAN',
keyPattern: { 'moves.name': 1 },
indexName: 'MovesName',
isMultiKey: true,
multiKeyPaths: { 'moves.name': [ 'moves' ] },
isUnique: false,
isSparse: false,
isPartial: false,
indexVersion: 2,
direction: 'forward',
indexBounds: { 'moves.name': [ '["thunder", "thunder"]' ] }
}
},
rejectedPlans: []
},
executionStats: {
executionSuccess: true,
nReturned: 232,
executionTimeMillis: 0,
totalKeysExamined: 232,
totalDocsExamined: 232,
executionStages: {
stage: 'FETCH',
nReturned: 232,
executionTimeMillisEstimate: 0,
works: 233,
advanced: 232,
needTime: 0,
needYield: 0,
saveState: 0,
restoreState: 0,
isEOF: 1,
docsExamined: 232,
alreadyHasObj: 0,
inputStage: {
stage: 'IXSCAN',
nReturned: 232,
executionTimeMillisEstimate: 0,
works: 233,
advanced: 232,
needTime: 0,
needYield: 0,
saveState: 0,
restoreState: 0,
isEOF: 1,
keyPattern: { 'moves.name': 1 },
indexName: 'MovesName',
isMultiKey: true,
multiKeyPaths: { 'moves.name': [ 'moves' ] },
isUnique: false,
isSparse: false,
isPartial: false,
indexVersion: 2,
direction: 'forward',
indexBounds: { 'moves.name': [ '["thunder", "thunder"]' ] },
keysExamined: 232,
seeks: 1,
dupsTested: 232,
dupsDropped: 0
}
}
},
serverInfo: {
host: 'DESKTOP-CS3UEH8',
port: 27017,
version: '4.4.0',
gitVersion: '563487e100c4215e2dce98d0af2a6a5a2d67c5cf'
},
ok: 1
}