PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Monday the 26th of January, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[04:22:18] <tim_t> hey all. how do I clear a collection using morphia API?
[04:23:08] <tim_t> like, with one call rather than say querying the collection and deleting by iteration?
[04:27:25] <tim_t> woo never mind. the solution is : ds.delete(ds.createQuery(entity.class));
[04:46:58] <smcguinness> i'm using geoNear and I'm getting results, however, as soon as I try to chain .limit and .skip, I'm getting an undefined error
[04:47:13] <smcguinness> How can I go about that?
[10:18:06] <Tomasso> the text search also works for arrays?
[10:58:27] <arussel> is there a way to do this http://docs.mongodb.org/manual/reference/operator/aggregation/concat/ but as result get "XYZ1" for _id 3 instead of null ?
[11:14:46] <StephenLynx> yes
[11:14:51] <StephenLynx> use a project block
[11:15:13] <StephenLynx> that allows you to change the keys and values of the results
[11:15:29] <StephenLynx> so you write something like _id:"$item"
[11:16:05] <TomBobo> hello world
[12:39:39] <arussel> StephenLynx: thanks, I found $ifNull to fix the problem
[15:11:47] <bigx> hello
[15:12:15] <bigx> I would like to conditionally remove a field with the aggergation framework
[15:12:23] <bigx> I tried the following
[15:12:35] <bigx> user: { $cond: [ { $eq : [ '$_id', 'undo' ] }, 1, 0 ] }
[15:13:21] <bigx> and it returns "user: 0" or "user: 1" depending on the $eq statement, but it's not removing the fiel from the projection
[15:17:08] <bigx> any idea?
[15:28:57] <bigx> I posted the question on SO if someone wants some rep points! http://stackoverflow.com/questions/28153168/mongodb-aggregation-with-project-to-conditionally-exclude-a-field
[16:08:09] <oblio> huzza
[16:09:02] <oblio> so i'm trying to drain a shard to de-comm it and it's been running on some last chunk of data for 2 or 3 days
[16:11:21] <oblio> anyone run into this or have any suggestions?
[16:12:02] <cheeser> are the other chunks full?
[16:45:39] <darkening> hi, i'm trying to update to mongodb 2.6.7 from mongodb 2.4.12 but seeing a severe performance degredation for a query. the query ran in a couple of milliseconds on 2.4 but now takes >60s to complete. i believe the query planner makes a poor choice, more details on indexes and query here: http://pastebin.com/x9B6spqL
[16:46:08] <oblio> cheeser: you mean the remaining chunk:?
[16:47:52] <cheeser> i mean the other chunks you're draining to
[16:53:51] <darkening> i added the explain from 2.4 as well: http://pastebin.com/Sca2c3qS ... i believe what is happening is that mongodb tries to use the "t_1" index for the $nin while not using the "s_1_t_1" index for both $in conditions but i'm not entirely sure about this
[17:07:43] <StephenLynx> a couple of ms to over a minute?
[17:08:32] <darkening> yes, 7ms to 71661ms ... i was shocked when i saw this
[17:09:53] <darkening> whats more, mongodb sucks 100% of one core while it's working on the query
[17:10:05] <StephenLynx> http://stackoverflow.com/questions/26351714/query-with-in-and-nin-doesnt-use-index see if this is the same issue you are having
[17:13:00] <StephenLynx> ?
[17:13:15] <darkening> StephenLynx, thanks ... that looks just like my issue
[17:13:39] <StephenLynx> if I get it right, it was indeed a bug in a patch
[17:14:22] <StephenLynx> and if you are using the latest version and it remains present
[17:14:26] <StephenLynx> then you are out of luch
[17:14:29] <StephenLynx> luck*
[17:14:44] <darkening> sadly this links to https://jira.mongodb.org/browse/SERVER-12281 which might be fixed in 2.9 ...
[17:15:31] <StephenLynx> so you will have to either change your query or keep using the old version.
[17:27:55] <denym_> hey there short question about general mongo setup... I used brew and I can start it with a custom config... I added the path to the log file but I dont get any terminal output. Is it supposed to be like that?
[17:28:48] <digicyc> denym_: It's running as a daemon. use mongo and it's commands for status info.
[17:29:03] <digicyc> Unless you are expecting something else.
[17:29:28] <denym_> Usually when I run a daemon in foreground it outputs something :)
[17:29:53] <digicyc> How are you running it?
[17:30:14] <denym_> just typing `mongod --config=/path/`
[17:30:27] <denym_> to the right config ofcourse
[17:30:42] <digicyc> yeah.. surprised you're not seeing any kind of output afterwards.
[17:30:59] <digicyc> Maybe you're setting a --logpath
[17:31:39] <denym_> oh man now I get it I guess....
[17:31:44] <denym_> systemLog:
[17:31:45] <denym_> destination: file
[17:31:45] <denym_> path: /home/denym/.linuxbrew/var/log/mongodb/mongo.log
[17:31:50] <denym_> oh sorry about the multiline
[17:32:49] <denym_> so its just possible to output to system OR file?
[17:33:01] <darkening> StephenLynx yes, seems like my options are limited. thanks again for the link, at least this way i can vote for the issue :)
[17:33:16] <StephenLynx> np
[17:34:45] <denym_> mhm weird I changed it to systemLog.destination: syslog but still its silent oO
[17:36:56] <dsirijus> hm, i'm trying to query to get all with mongoose http://pastie.org/private/cydumjyugajty7nc41g95q
[17:37:11] <dsirijus> but doesn't work (returns nothing)
[17:43:37] <dsirijus> ah, nvm. it works, i just exit the app before the response :)
[18:08:17] <jumpman> Is there a Mongo query to return documents with an Array field that contains a parameter?
[18:08:35] <jumpman> IE, offer { interests: ['a', 'b', 'c'] }
[18:08:58] <jumpman> offers.find({interests: {$contains: 'a'}})
[18:11:46] <jumpman> offers.find({ $where: function() { return (this.interests.indexOf('a') > -1) } } );
[18:11:50] <jumpman> that should do it i think xD
[18:13:33] <cheeser> http://docs.mongodb.org/manual/reference/operator/query/where/#considerations
[18:14:15] <jumpman> odds that it will include another standard query operator are quite high
[18:14:45] <cheeser> http://docs.mongodb.org/manual/reference/operator/query/elemMatch/#op._S_elemMatch
[18:14:49] <cheeser> would that work?
[18:15:01] <cheeser> in general, you *really* don't to use $where
[18:16:24] <jumpman> I don't think so - unless I can somehow pass to the $elemMatch "$contains" or something
[18:36:44] <morenoh149> jumpman: $in
[18:37:17] <morenoh149> jumpman: http://docs.mongodb.org/manual/reference/operator/query/in/
[18:38:46] <jumpman> I thought that $in would return the document if the value of the field was within an array
[18:39:06] <jumpman> can I use it on an array too?
[18:39:09] <jumpman> with an array passed in to it?
[18:39:35] <jumpman> ah, yes there is
[18:39:36] <jumpman> fantastico
[18:42:46] <morenoh149> jumpman: 👾
[18:48:14] <parallel21> This might more so be a mongoose question, but when trying to update an array to null, mongodb won't update the document
[18:48:30] <parallel21> or the document will not update
[18:48:59] <cheeser> $unset ?
[18:50:42] <parallel21> But I'm not trying to unset only. I have a form with checkboxes, and when updating an item, unchecking a checkbox where all checkboxes are now unselected doesn't take effect
[18:51:35] <cheeser> ah
[19:02:09] <jumpman> unfortunately it seems like using $in on an empty array returns nothing
[19:02:19] <jumpman> but THAT'S OK, i can just modify my logic veeeery slightly
[20:29:17] <Dances> Question(Python3/MongoDB 2.6.1): I'm inserted datetime.utcnow() isntances like this mydict['date'] = datetime.utcnow() ... collection.insert(mydict), for some reason dates are getting stored as datetime.datetime instead of an ISODate object. How come? This works on my other mongo server no problem.
[20:33:51] <_newb> does anybody know if there's a mongodb equivilant to the mysql: DATE_FORMAT(FROM_UNIXTIME(timestamp),'%Y%m')
[20:35:34] <GothAlice> _newb: You'd just do that in whatever language you're using to write your application. MongoDB doesn't really have "server-side functions" like that.
[20:36:32] <GothAlice> _newb: datetime.datetime.fromtimestamp(timestamp).strftime('%Y%m') for example
[20:36:43] <_newb> GothAlice: even aggregate won't return a count of documents for each YYYYMM timestamp?
[20:37:40] <GothAlice> Well, yes, that's pretty much the exception here. You can $group on the values extracted from real dates via http://docs.mongodb.org/manual/meta/aggregation-quick-reference/#date-expressions
[20:38:35] <GothAlice> I.e. using {$group: {_id: {year: {$year: '$somedatefield'}, month: {$month: '$somedatefield'}}}} would work
[20:38:55] <GothAlice> But that only works on true date values, not UNIX timestamps.
[20:40:38] <_newb> GothAlice: I'm using timestamps, but i imagine the mongoid's timestamp will work?
[20:40:45] <GothAlice> No.
[20:41:02] <GothAlice> The date operators only work on true dates, not ObjectIds, nor UNIX timestamps.
[20:41:05] <_newb> GothAlice: so can i perform an aggregation of the last 36 months and find a count of documents within each month?
[20:41:29] <_newb> GothAlice: (without performing 36 queries)
[20:43:05] <GothAlice> _newb: Yes, but only really if you have a real date value. See https://gist.github.com/amcgregor/1ca13e5a74b2ac318017 for an example; this aggregates data per-day-of-the-week on the "h" field, which represents an hourly period.
[20:43:44] <_newb> GothAlice: okay thank you
[20:52:33] <oblio> cheeser: i'm not for sure how i would even specifically see that
[20:53:28] <oblio> cheeser: but the db i'm trying to move the stuff to has no moveChunk op running
[20:53:33] <oblio> it's like it failed and something didn't communicate
[21:02:47] <GothAlice> Hmm; I seem to have an interesting problem. If I store the "path" to a tree's leaf as a list of strings (i.e. ['foo', 'bar', 'baz']) I can easily mutate that list ($push, $pull, etc.) atomically, but I can't easily sort on it. If I store it as a coalesced string ('/foo/bar/baz') I can sort on it, but I can't atomically manipulate it. Ideas?
[21:03:51] <GothAlice> (Trying to optimize both the "all descendants" query and "attach" update which needs to handle moving whole sub-trees.)
[21:05:45] <_newb> GothAlice: your solution worked terrifically for me, thank you again for your suggestion.
[21:05:55] <GothAlice> _newb: It never hurts to help. :)
[21:07:00] <_newb> GothAlice: hehe.. so true. i wish i knew what advice to give for yours.
[21:10:40] <GothAlice> My kingdom for an atomic string prepend.
[21:33:00] <winem> hi, I have a quick question regarding the online courses. it says "build an index on the "active" and "tstamp" fields." << do I get this right and they mean a covered index?
[21:33:07] <winem> I'm not a native speaker so I just want to be sure before I complete the index... I'd expect "... build one index..." if they're talking about covered indexes, but as I said, I'm not sure
[21:35:07] <jumpman> winem: i have no answer for you. However, i'm trying to figure out how to support keyword seaching/text searching right now
[21:35:10] <jumpman> http://docs.mongodb.org/manual/core/index-text/
[21:35:41] <jumpman> seems like from the verbage on the site you would want to start here: http://docs.mongodb.org/manual/core/indexes-introduction/
[21:36:05] <winem> I understand how they work and I'm really impressed by them. especially by the text index
[21:36:30] <winem> was just not sure if they ask for 2 indexes (1 per field) or 1 index that covers both. but it looks like they asked for the last one :)
[21:39:25] <winem> thanks jumpman. it worked with a covered one
[21:52:18] <plato1> is this a well formed query? i cant figure out why it returns no docs { timestampReported: { '$lt': 1421733600000, '$gt': 1421647200000 } }
[21:57:49] <joannac> umm
[21:57:57] <joannac> oh, yup
[21:58:13] <joannac> plato1: it is. what do you expect it to match?
[22:02:23] <plato1> every doc in the collection with a timestamp property whose value is between those two numbers
[22:02:31] <plato1> *with a timestampReported property...
[22:22:04] <midnight_> hey, I've noticed that the ubuntu meta-package for 3.0.0-rc6 (mongodb-org) doesn't update the child packages when I run a simple "apt-get install mongodb-org"
[22:22:08] <midnight_> is this to be expected?
[22:37:52] <UnNaturalHigh> Can someone here help me understand how Mongodb works with timezones with the pymongo client? Lets say I insert date1 in my collection with GMT offset -7 and then insert date 2 in my collection with GMT offset -6. I then query for date1 and date2, would the time of date1 and date2 be in my current timezone?
[22:52:50] <jayjo> Is it possible to define a field in a document that relies on another field? Eg, 'title' and then automatically create a 'url' field, both strings
[22:55:18] <Sengoku> Hey
[23:02:52] <kaiju_sloth> I have a few corrupted document in my collection and I'm having trouble identifying / removing them. Already tried repair db with no result. They cause breaks in my cursor streams. Any good suggestions?