PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Tuesday the 12th of June, 2018

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[05:47:39] <Jonno_FTW> how do I get those documents where the current time is 24 hours after a datetime field?
[05:49:57] <Jonno_FTW> actually I'll just have an extra field
[06:57:27] <justanotheruser> how can I use $mod on a timestamp? Is there some way I can convert it to an int in the query?
[09:43:13] <Derick> justanotheruser: you can - via a conversion with $dateToString
[12:29:32] <marcelofr> Hi!. I've configured a replica set with a primary, secondary and arbiter (with keyfile). Every things is ok, but the network traffic is a few MB/s on primary, a few Kb/s in secondary, but arbiter has the same bandwidth of primary. Is this ok?
[12:34:54] <Derick> the arbiter should have virtually none - except for some heartbeats
[15:56:54] <RobertPlummer> Is there the capability in mongo to use a javascript module or plugin?
[15:57:03] <RobertPlummer> If so, where is the documentation?
[16:17:56] <Derick> no, there is not
[16:18:13] <Derick> you should not be wanting to run javascript in the server
[16:42:22] <justanotheruser> Derick: dateToString? I can perform modulo on string and mongo will convert it to int?
[16:44:49] <Derick> dateToString to turn timestamp into a string containing numbers since the epoch, and then "convert" to turn it into an int
[16:52:26] <justanotheruser> what is the format specifier for that?
[16:52:31] <justanotheruser> also what is "convert"?
[16:52:47] <justanotheruser> I'm on the page, and don't see any format specifiers
[16:53:03] <justanotheruser> though actually, this gives me a solution to my problem, and I don't have to use $mod anymore, thanks
[16:53:12] <justanotheruser> I was checking timestamp % 3600 == 0
[16:54:17] <Derick> you are checking whether the minutes are 0
[16:54:37] <justanotheruser> right
[16:55:00] <justanotheruser> and seconds
[16:55:07] <Derick> $dateToString(format: "h", date: '$timestampField') in the aggregation framework should do the trick
[16:55:30] <Derick> or then, seconds too: "%H%M"
[16:55:47] <Derick> → $dateToString(format: "%H%M", date: '$timestampField')
[16:55:58] <Derick> ugh
[16:56:00] <Derick> sorry
[16:56:10] <Derick> → $dateToString(format: "%M%S", date: '$timestampField')
[16:56:17] <Derick> which you then can compare with "0000"
[16:57:09] <justanotheruser> yep, got it, thanks
[17:00:25] <Derick> I'm going home, good luck :)
[17:00:44] <Derick> there is an example at https://docs.mongodb.com/manual/reference/operator/aggregation/dateToString/#example too
[23:20:22] <justanotheruser> Derick: do you know how I could use that in pymongo? I'm trying to query it like so https://hastebin.com/raw/uticutitiy
[23:20:29] <justanotheruser> but I get pymongo.errors.OperationFailure: unknown top level operator: $ne