stijnsanders / TMongoWire

Delphi MongoDB driver
MIT License
102 stars 37 forks source link

Explain query implementation #5

Closed fabriciocolombo closed 11 years ago

fabriciocolombo commented 12 years ago

Implementation of explain method in TMongoWireQuery class.

stijnsanders commented 12 years ago

Though I appreciate your proposal, I was looking to check which commands are provided by the mongo shell, and provide them all at once in an addition to TMongoWire. Your code did give me some idea's, for example BSON() should accept and ignore any 'nil' values, so you could write BSON(['$explain',true,'query',Query,'orderby',OrderBy]) and not longer need a local variable and an if statement.

fabriciocolombo commented 12 years ago

Yes, this would produce cleaner code. About the "orderby", he results the same effect as the special field "$orderby".

There are two other options that can influence the outcome of "$explain" and could be used to run a query: $hint and $snapshot.

stijnsanders commented 12 years ago

Hmm, do you know about 'VarArrayOf([...])'? I'll check the AV somewhere in the next few weeks.

fabriciocolombo commented 12 years ago

Really, I had forgotten VarArrayOf. Here is where the AV is raised: https://github.com/fabriciocolombo/TMongoWire/commit/992191ea09a0f6dd5ea7fcbf5bb37abd98f8cc84

stijnsanders commented 12 years ago

Thank you. Found it. Looks like any directly nested arrays would have had trouble.