On Fri, 30 Nov 2012 12:15:57 +0100, Sönke Ludwig wrote:

Am 30.11.2012 01:15, schrieb Ekyo:

ensureIndex only queries the collection in the first place before trying to insert the index in it
to avoid useless insertions.

Thanks for the info, I've committed a simple implementation to master. It seems like the DB already
checks if the index exists and does not reindex, so an additional query might not be necessary... or
do you see a concrete reason for this?

I don't know, in all drivers I checked there is an 'ensureIndex' function that check first and add only if it doesn't exist.

Btw. is there some kind of authoritative source for this kind of information? I just found the low
level protocol information and high level client information, as well as some of those internal
things scattered around. But most of the stuff either had to be reverse engineered by looking at the
log output of the server or by looking at other client's source code.

yes there is: MongoDB - Writing Drivers
but I mostly looked in other drivers (js, C, python and Haskell).