Monday, April 6, 2015

M102: MongoDB for DBAs - Homework 3.1

Step 1:
Download the handout and load in mongodb using

mongo --shell localhost/performance performance.js


then run

homework.init()


you need to add index on field
active and timestamp

Step 2:
Add Index using

db.sensor_readings.ensureIndex({tstamp:1, active:1})

Step 3:
run homework.a()

you will get answer as 6

if anything wrong you will get a message to try better index

No comments:

Post a Comment