javascript - MongoDB database db.collection.find returns results but meteor-angular pub/sub nor collection.find does not -


in meteor have:

var data_set = elephant_site_service_calcs_ts.find(                         {                             calc_tag_id: parseint(calc.alert_id),                             calc_ts_update_hour: start_date                         }); console.log(data_set.fetch()); 

in autorun. testing have:

var calc_tag_data =  $meteor.collection(elephant_site_service_calcs_ts)                         .subscribe('site_calcs_realtime',{                             calc_ts_update_hour: 1,                             calc_tag_id: 1,                             values: 1                         },                         {                             calc_tag_id: parseint(calc.alert_id),                             calc_ts_update_hour:                             {                                 $gt:  start_date.tostring()                             }                          }); console.log("calc time series data " + calc_tag_data); 

when run either of them directly against mongodb get:

elephant_data_replicaset:primary> db.elephant_calc_evalv_ts.find( ...     { ...             calc_tag_id: 138, ...             calc_ts_update_hour: ...             { ...                 $gt:  '2015-08-24 15:00:00' ...             } ... ...     }, ...     { ...         calc_ts_update_hour: 1, ...         calc_tag_id: 1, ...         values: 1 ...     });  { "_id" : objectid("55dba62a71aad4b469c2dcd7"), "calc_tag_id" : 138,     "calc_ts_update_hour" : "2015-08-24 16:00:00", "values" : { "18" : { "2" : 0.00011940298507462686 }, "53" : { "22" : 0.00011940298507462686 } } } { "_id" : objectid("55dbb8a571aad4b469c2dce6"), "calc_tag_id" : 138, "calc_ts_update_hour" : "2015-08-24 17:00:00", "values" : { "36" : { "53" : 0.00011940298507462686 } } }  elephant_data_replicaset:primary> db.elephant_calc_evalv_ts.find(     {              calc_tag_id: 138,             calc_ts_update_hour:             {                 $gt:  '2015-08-24 15:00:00'             }      },     {         calc_ts_update_hour: 1,         calc_tag_id: 1,         values: 1     }); { "_id" : objectid("55dba62a71aad4b469c2dcd7"), "calc_tag_id" : 138, "calc_ts_update_hour" : "2015-08-24 16:00:00", "values" : { "18" : { "2" : 0.00011940298507462686 }, "53" : { "22" : 0.00011940298507462686 } } }  { "_id" : objectid("55dbb8a571aad4b469c2dce6"), "calc_tag_id" : 138, "calc_ts_update_hour" : "2015-08-24 17:00:00", "values" : { "36" : { "53" : 0.00011940298507462686 } } } elephant_data_replicaset:primary> cls elephant_data_replicaset:primary> db.elephant_calc_evalv_ts.find(     {                calc_tag_id: 138,             calc_ts_update_hour:             {                   $gt:  '2015-08-24 15:00:00'             }      },     {            calc_ts_update_hour: 1,         calc_tag_id: 1,         values: 1     }); { "_id" : objectid("55dba62a71aad4b469c2dcd7"), "calc_tag_id" : 138, "calc_ts_update_hour" : "2015-08-24 16:00:00", "values" : { "18" : { "2" : 0.00011940298507462686 }, "53" : { "22" : 0.00011940298507462686 } } } { "_id" : objectid("55dbb8a571aad4b469c2dce6"), "calc_tag_id" : 138,   "calc_ts_update_hour" : "2015-08-24 17:00:00", "values" : { "36" : { "53" : 0.00011940298507462686 } } } elephant_data_replicaset:primary> db.elephant_calc_evalv_ts.find(     {             calc_tag_id: 138,             calc_ts_update_hour:  '2015-08-24 15:00:00' },     {         calc_ts_update_hour: 1,         calc_tag_id: 1,         values: 1     }); { "_id" : objectid("55db93fc71aad4b469c2dcc6"), "calc_tag_id" : 138, "calc_ts_update_hour" : "2015-08-24 15:00:00", "values" : { "0" : { "28" : 0.00011940298507462686 }, "10" : { "16" : 0.00011940298507462686 }, "19" : { "2" : 0.00011940298507462686 }, "30" : { "53" : 0.00011940298507462686 } } } elephant_data_replicaset:primary> 

but when run through meteor get:

getting calc current value time series data: 133 elephanttopiclistctrl.js?f5170d3f444b49f17026653cb5c451bda922d0e3:120 data hour: 2015-08-24 15:00:00 data minute: 52 calc_id 133 elephanttopiclistctrl.js?f5170d3f444b49f17026653cb5c451bda922d0e3:129 [] elephanttopiclistctrl.js?f5170d3f444b49f17026653cb5c451bda922d0e3:146 calc time series data  elephanttopiclistctrl.js?f5170d3f444b49f17026653cb5c451bda922d0e3:294 processing calc dataset 

pretty empty dataset. on server publish routine have:

meteor.publish("site_calcs_realtime", function(options, searchstring) { console.log("calcs realtime"); console.log(searchstring); console.log(options);  if(searchstring == null)     searchstring = {};  //get real time data past hour tags //console.log(elephant_site_service_calcs_ts.find(searchstring, options)); return elephant_site_service_calcs_ts.find(searchstring, options); }); 

the output meteor command line:

i20150824-20:04:30.236(-7)? calcs realtime i20150824-20:04:30.237(-7)? { calc_tag_id: 133, i20150824-20:04:30.237(-7)?   calc_ts_update_hour: { '$gt': '2015-08-24   15:00:00' } } i20150824-20:04:30.237(-7)? { calc_ts_update_hour: 1, calc_tag_id: 1, values: 1 } i20150824-20:04:30.269(-7)? calcs realtime i20150824-20:04:30.269(-7)? { calc_tag_id: 134, i20150824-20:04:30.269(-7)?   calc_ts_update_hour: { '$gt': '2015-08-24 15:00:00' } } i20150824-20:04:30.269(-7)? { calc_ts_update_hour: 1, calc_tag_id: 1, values: 1 } i20150824-20:04:30.307(-7)? calcs realtime i20150824-20:04:30.308(-7)? { calc_tag_id: 135, i20150824-20:04:30.308(-7)?   calc_ts_update_hour: { '$gt': '2015-08-24 15:00:00' } } i20150824-20:04:30.308(-7)? { calc_ts_update_hour: 1, calc_tag_id: 1, values: 1 } i20150824-20:04:30.328(-7)? calcs realtime i20150824-20:04:30.328(-7)? { calc_tag_id: 136, i20150824-20:04:30.329(-7)?   calc_ts_update_hour: { '$gt': '2015-08-24 15:00:00' } } i20150824-20:04:30.329(-7)? { calc_ts_update_hour: 1, calc_tag_id: 1, values: 1 } i20150824-20:04:30.348(-7)? calcs realtime i20150824-20:04:30.348(-7)? { calc_tag_id: 137, i20150824-20:04:30.348(-7)?   calc_ts_update_hour: { '$gt': '2015-08-24 15:00:00' } } i20150824-20:04:30.348(-7)? { calc_ts_update_hour: 1, calc_tag_id: 1, values: 1 } i20150824-20:04:30.366(-7)? calcs realtime i20150824-20:04:30.366(-7)? { calc_tag_id: 138, i20150824-20:04:30.367(-7)?   calc_ts_update_hour: { '$gt': '2015-08-24 15:00:00' } } i20150824-20:04:30.367(-7)? { calc_ts_update_hour: 1, calc_tag_id: 1, values: 1 } 

this entire autorun:

$meteor.autorun($scope, function() {             $meteor.subscribe('site_topic_calc_data', {                 limit: parseint($scope.getreactively('perpage')),                 skip: (parseint($scope.getreactively('page')) - 1) *    parseint($scope.getreactively('perpage')),                 sort: $scope.getreactively('sort')             }, {'alert_site_id':      parseint($stateparams.site_id)}).then(function() {                 $scope.site_calcs_count = $meteor.object(counts     ,'number_of_calcs', false);                 $scope.site_services_count = $meteor.object(counts ,'number_of_services', false);                  $scope.site_calcs.foreach( function(calc) {                     console.log("getting value information calc tag " +   calc);                     console.log("getting calc current value time series     data: " + calc.alert_id)                     // console.log("preparing current value query...");                     var start_date = moment(new date()).subtract(4, 'hours').format('yyyy-mm-dd hh:00:00');                     // console.log(start_date)                     //used go 5 minutes in case query false  within                     var durationinminutes = 5;                     var value_minute = (new date().getminutes() - durationinminutes);                     console.log("data hour: " + start_date.tostring() + " data  minute: " + value_minute.tostring() +                         " calc_id " + calc.alert_id);                      var data_set = elephant_site_service_calcs_ts.find(                         {                             calc_tag_id: parseint(calc.alert_id),                             calc_ts_update_hour: start_date                         });                      console.log(data_set.fetch());                      var calc_tag_data =          $meteor.collection(elephant_site_service_calcs_ts)                         .subscribe('site_calcs_realtime',{                             calc_ts_update_hour: 1,                             calc_tag_id: 1,                             values: 1                         },                         {                             calc_tag_id: parseint(calc.alert_id),                             calc_ts_update_hour:                             {                                 $gt:  start_date.tostring()                             }                          });                     console.log("calc time series data " + calc_tag_data);                      $scope.formattagvalue(calc_tag_data);                  });                  $scope.elephant_services.foreach( function (service_element) {                     //get tags                      //do foreach on each tag                     //when clicked show graph popout                     service_element.onclicked = function () {                         //get service tags                         console.log("getting servers service: " +  service_element.service);                         var service_meta = service_server_dict_map.find({name: service_element.service});                         console.log("getting service: " + service_meta + "    server information site id: " +                             site_id);                         $scope.get_service_site_servers(service_meta);                         //go tag_trend                         //create tag list view t                         //allows user build trend of tags in service                         //$state.go('tag_trend_details', {calc_id: calc._id});                     };                 });             });         }); 

please advise why meteor not returning results autorun expected. when comment out find on server side , add fetch results expected. problem dataset not being return frontend @ all.

one last thing. router:

.state('site_status',             {                 url:'/site_status/:site_id/:site_name',                           templateurl:'client/elephant_heard_view/view/elephantprocess.ng.html',                 controller:'elephant_site_server_service_stats_ctrl',                 resolve:                 {                     'subscribe':                         [                             "$meteor", function($meteor)                         {                             return $meteor.subscribe('site_topic_calc_data');                         },                          ],                     'subscribe':                         [                             '$meteor', function($meteor)                         {                             return $meteor.subscribe('site_calcs_realtime');                         }                         ],                     'subscribe':                         [                             '$meteor', function($meteor)                         {                             return $meteor.subscribe('site_servers');                         }                         ],                     'subscribe':                         [                             '$meteor', function($meteor)                         {                             return $meteor.subscribe('site_tags');                         }                         ],                     'subscribe':                         [                             '$meteor', function($meteor)                         {                             return elephant_site_service_calcs_ts.find();                         }                         ]                 }             }) 

collection defined in model

elephant_site_service_calcs_ts = new mongo.collection("elephant_calc_evalv_ts"); 


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -