Hello, please correct me if I’m doing something wrong.
If I run the following query without filtering the date, I can retrieve all the results I’m looking for.
const query = new Moralis.Query(mptT)
.limit(1000000)
.select("block_timestamp")
.equalTo("to", factory.toLowerCase());
const results = await query.find();
console.log("Request took:", new Date() - start, "ms");
console.log("retrieved:", results.length);
let date = [];
for (let i = 0; i < results.length; i++) {
const object = results[i];
date.push(object.get("block_timestamp"));
}
console.log(new Date(Math.max.apply(null, date)));
console.log(new Date(Math.min.apply(null, date)));
};
results :
Request took: 3949 ms
retrieved: 16652
2021-11-20T11:16:05.000Z
2021-10-18T15:03:36.000Z
As you can see, the earliest transaction returns the 18 of October 2021.
However, if I run de same query with a filter .greaterThan(“block_timestamp”, new Date(“2021-10-01”));
const query = new Moralis.Query(mptT)
.limit(1000000)
.select("block_timestamp")
.equalTo("to", factory.toLowerCase())
.greaterThan("block_timestamp", new Date("2021-10-01"));
const results = await query.find();
console.log("Request took:", new Date() - start, "ms");
console.log("retrieved:", results.length);
let date = [];
for (let i = 0; i < results.length; i++) {
const object = results[i];
date.push(object.get("block_timestamp"));
}
console.log(new Date(Math.max.apply(null, date)));
console.log(new Date(Math.min.apply(null, date)));
};
results :
Request took: 1661 ms
retrieved: 1957
2021-11-20T11:16:26.000Z
2021-11-17T01:01:48.000Z
I would expect to find the same results as my first query, however, as you can see, I only retrieve a part of them.
It’s interesting to note that on the second query, the earliest entry I retrieve is when I started the event sync. It seems that any block_timestamp less than the createdAt aren’t retrieved.