Hi,
There will be one index, and the original types will be indexed (strings as string, etc).
That means that for your above examples, the following will return no results (searching for string as integer and vice-versa):
db.foo.find({a:'1'})
db.foo.find({a:2})
This also means you can insert two documents with similar keys but different types:
db.foo.insert({a:1});
Similarly, strings and numbers have different sort orders so you may get unexpected sorting and ranged search results with mixed types.
The caveats may be fine for your use case, but in general I think it would be better to keep the type consistent rather than trying to save a few bytes.
Cheers,
Stephen