suppose I have a database in mongodb called "test" inside this db "test", I have 3 collections, which is "test-subone", "test-subtwo", "test-subthree". let's assume that those 3 collections have an attribute in common, which is "testattr". And what I want is create a text index for attribute "testattr" in those 3 collections.
am I right if I do this way :
db.collection.createIndex({"testattr":"text"})
or do I have to create the text index for each collection, i.e. :
db.test-subone.createIndex({"testattr":"text"})
db.test-subtwo.createIndex({"testattr":"text"})
db.test-subthree.createIndex({"testattr":"text"})
and I want to ask, what is the difference between the "db.collection.createIndex" and "db..createIndex"?
Thank you very much for your help