O'Reilly logo

Mastering Internet of Things by Peter Waher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Returning historical values

If historical values are desired, we can send our partial results immediately, to allow the client to provide some immediate feedback. Loading historical data can take a little time, depending on the underlying storage medium and amount of data stored:

if (e.IsIncluded(FieldType.Historical)) 
{ 
e.ReportFields(false, Fields); 
Fields.Clear(); 

To avoid too large stanzas and allow the client to follow the progress, we can choose to return historical elements, 50 at a time:

foreach (LastMinute Rec in await Database.Find<LastMinute>(new FilterAnd( new FilterFieldGreaterOrEqualTo("Timestamp", e.From), new FilterFieldLesserOrEqualTo("Timestamp", e.To)), "Timestamp")) { if (Fields.Count > 50) { e.ReportFields(false, Fields); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required