You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var fdb = new ForerunnerDB();
var cdb = fdb.db("compute");
var fdbcollection = cdb.collection("vipData").deferredCalls(false);
vipPass = vipPass.map(function (vp) {
console.log(vp.vip_end
instanceof
Date)
return {
u_id: vp.u_id,
vip_end: fdb.make(vp.vip_end),
vip_start: fdb.make(vp.vip_start)
}
})
// insert data into forerunner db
fdbcollection.insert(vipPass)
console.log("DATA inserted into forerunner.")
// query data based on operator based date.
let results = fdbcollection.find({
u_id: singleTxnObj.u_id,
// vip_end: {$lte: singleTxnObj.createdAt.toString()},
// vip_start: {$gte: singleTxnObj.createdAt.toString()}
}, {
$limit: 1
});
console.log(singleTxnObj.createdAt instanceof Date) //true
console.log(luxon.DateTime.fromISO(singleTxnObj.createdAt.toString()).toJSDate() instanceof Date) // true
console.log(results[0].vip_end instanceof Date) // true
console.log(results[0].vip_start instanceof Date) // true
as per the code above I have inserted Date fields with other fields and also in case of results from query I can see that the fields are instance of Date.
I have used fdb.make, but the result based on $gte & $lte doesn't work, as it doesn't return any data results.
Wanted to know if $gte & $lte can be applied to queries like these?
The text was updated successfully, but these errors were encountered:
shubhanshusingh
changed the title
using Date to with $gte and $lte operators.
using Date query with $gte and $lte operators.
Dec 12, 2019
as per the code above I have inserted Date fields with other fields and also in case of results from query I can see that the fields are instance of Date.
I have used fdb.make, but the result based on $gte & $lte doesn't work, as it doesn't return any data results.
Wanted to know if $gte & $lte can be applied to queries like these?
The text was updated successfully, but these errors were encountered: