Friday, September 19, 2014

M101J: MongoDB for Java Developers Final: Question 1

M101J: MongoDB for Java Developers Final: Question 1
Step 1:
download the Enron email dataset enron.zip

Step 2:
extract enron.zip and from command prompt type
mongorestore --host 192.168.50.4 --port 27017  messages.bson

Step 3:
Check the data that has been imported.
using
1) db.enron.messages.find().count()  it should be 120,477 documents after restore.

2) db.messages.find({"headers.From":"andrew.fastow@enron.com", "headers.To": "john.lavorato@enron.com"}).count() will result in 1.
this will ensure you have correct data to work on

Solution:
type below query:
db.messages.find({"headers.From":"andrew.fastow@enron.com", "headers.To": "jeff.skilling@enron.com"}).count()

you will get your answer as 3




No comments:

Post a Comment