couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramanadham, Radhika" <radhika.ramanad...@emc.com>
Subject Question on views
Date Mon, 09 Jun 2014 16:36:33 GMT

Hi,

I have a view which has 2 keys- key1 and key2:

"by_server": {
                "map": "function(doc) { if ((doc.type == 'performance_stats'))  emit([key1,
key2],{ 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory, 'FileSystem':doc.FileSystem
}) }"
 },


If I want to query the view where I need all the rows for key2 and key1 being anything, how
do I do it?

Let's say my data is->

{"id":"server_lglod025.lss.emc.com_2014-06-09_10:24:18","key":["lglod025.lss.emc.com","SRMSuite_3.0.2_test1"],"value":{"Start_time":"2014-06-09
09:00:00","CPU":12,"Memory":98,"FileSystem":96}},
{"id":"server_lglod093.lss.emc.com_2014-06-09_11:24:18","key":["lglod093.lss.emc.com","SRMSuite_3.0.2_test2"],"value":{"Start_time":"2014-06-09
10:00:00","CPU":12,"Memory":98,"FileSystem":97}},
{"id":"server_lglod174.lss.emc.com_2014-06-04_14:01:44","key":["lglod174.lss.emc.com","SRMSuite_3.0.2_test2"],"value":{"Start_time":"2014-06-04
10:00:00","CPU":67,"Memory":97,"FileSystem":17}},

I only want the below 2 rows who have a key2 = SRMSuite_3.0.2_test2, how do I do it?

{"id":"server_lglod093.lss.emc.com_2014-06-09_11:24:18","key":["lglod093.lss.emc.com","SRMSuite_3.0.2_test2"],"value":{"Start_time":"2014-06-09
10:00:00","CPU":12,"Memory":98,"FileSystem":97}},
{"id":"server_lglod174.lss.emc.com_2014-06-04_14:01:44","key":["lglod174.lss.emc.com","SRMSuite_3.0.2_test2"],"value":{"Start_time":"2014-06-04
10:00:00","CPU":67,"Memory":97,"FileSystem":17}},

Thanks,
Radhika

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message