0

I have list of field names in a file "field_name_list.txt". I want to know which field exists in which collection in Mongo database using Java script or MapReduce job or some Mongo code.

Let me give example

field_name_list.txt

Firstname 
lastname
Address
zip 

Collection in the database:

personal_data
adress 

I want output like below:

Fieldname      collection_name 

Firstname      personal_data

lastname       personal_data

Address        Address

zipcode        Address
Manjunath Ballur
  • 6,287
  • 3
  • 37
  • 48
user2609099
  • 27
  • 1
  • 6
  • OK, so, what what you tried/where have you gotten stuck? As MongoDB is schema-less, you'll need to loop through every document to determine what fields exist for each collection. – WiredPrairie Aug 14 '13 at 00:55
  • 1
    Please stop asking the same question. Just edit the original question if you want to add additional clarification. http://stackoverflow.com/questions/18006980/how-to-add-collection-name-in-the-output-of-map-reduce-job-to-get-all-the-keys-i?noredirect=1#comment26707948_18006980 – WiredPrairie Aug 14 '13 at 00:57
  • I have a code to get all the field names in all collections of the datatbase.But there to no way to print collection name with field name .Thats why i have changed my logic once get the fields then based on filed name to get collection name using $exists function in mongo.Please help me if you have any idea. – user2609099 Aug 14 '13 at 04:14
  • http://stackoverflow.com/questions/2298870/mongodb-get-names-of-all-keys-in-collection – WiredPrairie Aug 14 '13 at 10:45

0 Answers0