alienhunter Active Member Licensed User Longtime User May 18, 2022 #1 Hi To All how to add a date filed in mongo instead of a string date ? date insert: jobs.Insert(Array(CreateMap("machineid": portmachine,"machinename": namemachine, _ "machinedate": DateTime.Now ,"machinehour":hourstring1,"speedover":speedoverride,"feedover":feedoverride,"rapidover":rapidoverride, _ "actualspeed":actspeed,"actualfeed":actfeed))) thank you very much Alfred Attachments datefield.PNG 8.5 KB · Views: 283
Hi To All how to add a date filed in mongo instead of a string date ? date insert: jobs.Insert(Array(CreateMap("machineid": portmachine,"machinename": namemachine, _ "machinedate": DateTime.Now ,"machinehour":hourstring1,"speedover":speedoverride,"feedover":feedoverride,"rapidover":rapidoverride, _ "actualspeed":actspeed,"actualfeed":actfeed))) thank you very much Alfred
Erel B4X founder Staff member Licensed User Longtime User May 18, 2022 #2 It being a while since I developed with MongoDB... What is jobs? Are you using the RDC equivalent framework? Upvote 0
It being a while since I developed with MongoDB... What is jobs? Are you using the RDC equivalent framework?
alienhunter Active Member Licensed User Longtime User May 19, 2022 #3 Hi Erel jobs is the Collection (table) "db.example.insert({"date":ISODate("2016-03-03T08:00:00.000")});" sorry i do not know how send this ISO stuff B4X: mongo.Initialize("", "mongodb://10.0.2.7") poolconnection db = mongo.GetDatabase("ias") momgolist.Initialize ' jobs = db.GetCollection(jonbrstr) jobs.CreateIndex(CreateMap("machineid": 1)) note: this mongo stuff if awsome i love it how it works in b4x thank you Upvote 0
Hi Erel jobs is the Collection (table) "db.example.insert({"date":ISODate("2016-03-03T08:00:00.000")});" sorry i do not know how send this ISO stuff B4X: mongo.Initialize("", "mongodb://10.0.2.7") poolconnection db = mongo.GetDatabase("ias") momgolist.Initialize ' jobs = db.GetCollection(jonbrstr) jobs.CreateIndex(CreateMap("machineid": 1)) note: this mongo stuff if awsome i love it how it works in b4x thank you
Erel B4X founder Staff member Licensed User Longtime User May 20, 2022 #4 Try this: B4X: Sub CreateJavaDate(Ticks As Long) As Object Dim jo As JavaObject jo.InitializeNewInstance("java.util.Date", Array(Ticks)) Return jo End Sub ... "machinedate": CreateJavaDate(DateTime.Now) Upvote 0
Try this: B4X: Sub CreateJavaDate(Ticks As Long) As Object Dim jo As JavaObject jo.InitializeNewInstance("java.util.Date", Array(Ticks)) Return jo End Sub ... "machinedate": CreateJavaDate(DateTime.Now)
alienhunter Active Member Licensed User Longtime User May 20, 2022 #5 Thank you very much Erel This is awesome , this worked the field is a Date Alfred Attachments mongodate.PNG 7.7 KB · Views: 279 Upvote 0