I have two unix timestamps, a start time (startDate) and an end time (endDate). Using the moment function below gives me the very start/end of the day:
search = {
"end": { "$lte": moment(endDate).startOf('day').unix() },
"start": {"$gte": moment(startDate).startOf('day').unix() }
};
I then pass my search into my buildfire function:
buildfire.publicData.search(search ,'routes', (err, res) => {})
My res is an array of objects, each has a data property with a start and end property inside of that:
res = [
{
data: {
end: 1503554370297,
start: 1503554368711
}
}
]
All results are returning, nothing is being filtered.
Here is the docs datastore search https://github.com/BuildFire/sdk/wiki/How-to-use-Datastore#buildfiredatastoresearchoptions-tag-optional-callback
I believe you are not sending the filter correctly.
You are sending:
And it should be more like
Basically since your
filter
property in youroptions
objectisundefined
it returns everything