We have a hundred computers running, each computer will send back a heartbeat once in few minutes. we capture those heart beats in our mongodb database. Now we want to check when was last time they sends back their heart beat. One solution we have is to query for each node and get back its last heart beat time. But that'll introduce same number of queries to the database as the number of nodes we have. We wonder if there is a simpler approach to do that.
To be more specific, we store each heart beat from a node in a separate document, something like the following
{
"_id" : ObjectId("51d173adedfce2c67fe04c4a"),
"nodeId" : 260,
"heartBeat" : NumberLong(1374778030),
"status" : "DEPLOYED"
}