meteorminimongo

Is minimongo's findOne constant time for indexed fields?


I know that findOne is constant time when using it in the following way:

collection.findOne(aString)

However, I can't seem to find out if it's still constant time when querying an indexed field that isn't _id. For example, I have a collection that's mirroring an external API. In this collection, there's a separate id field that's indexed.

My question is, is collection.findOne({ id: anId }) still constant time?


Solution

  • Yes. From the minimongo documentation: "Internally, all documents are mapped in a single JS object from _id to the document. Besides this mapping, Minimongo doesn't implement any types of secondary indexes."

    Source: https://github.com/meteor/meteor/tree/master/packages/minimongo