[00:41:31] <Boomtime> @fxmulder: I dropped out of the channel apparently, is your question about IO still relevant? FYI, mms.mongodb.com
[00:54:34] <sabrehagen> i'm trying to work out the best way to write a query. i have server logs stored in mongodb, and each log entry has a user property. i want to build a query that will show me users that were active each week for n weeks.
[00:54:39] <sabrehagen> e.g. for n=3, i want to know only users that were active this week, last week, and the week before.
[00:54:44] <sabrehagen> so far my idea is to have something like { $and : [ { $and : [ { user : 'username' }, { _id : { $gt : from1 } }, { _id : { $lt : to1 } } ] }, { same $and object as before but with from2, and to2 } ] }
[00:54:48] <sabrehagen> is that a terrible way to do the query? how mongodb-processing-intensive is that way? should i be using the aggregation framework?
[00:58:18] <fxmulder> Boomtime: it is, it's rather strange not sure why this machine is different from the other two, I've killed everything but mongodb and its still high IO and it isn't the primary
[00:59:43] <fxmulder> the write rate on it is quite low and the read rate is quite high
[01:42:49] <xack-work> I'm noob to mongodb. Is this a channel I'm free to ask random noob like questions? (While I do heavily research, some documentation isn't too great for me)
[01:45:15] <Boomtime> you will get better answers whenever you can demonstrate you've already tried to learn something yourself of course
[01:46:03] <xack-work> I'm from a long term experience of MySQL junk and other RDMS's, so..
[01:46:21] <xack-work> Have you messed with the shard/clustering of MongoDB much? I really enjoy the elegance and documentation
[01:46:40] <xack-work> will be implementing it soon. hoping it isn't a huge resource hog.
[01:54:53] <xack-work> most of my pains are things like: this doesn't work: { _id: { $in: [ ObjectId('561b920d5ac3a9e258178c67') ] }, worker.id: { $exists: false }
[01:54:55] <xack-work> but this does: { $and: [ { _id: ObjectId('561b920d5ac3a9e258178c67')}, { "worker.id": { $exists: false } } ] }
[01:55:50] <xack-work> yeah.. queries get a bit ugly some times. Hehe.
[01:59:01] <Boomtime> you don't need $and in that query
[01:59:14] <Boomtime> the only other difference is that 'worker.id' is quoted
[01:59:20] <Boomtime> and it must be to be valid JSON
[02:00:06] <Boomtime> otherwise the two queries are identical - the only reason you ever need to use $and is when there is a conflict with names at the same level, which many JSON parsers don't like
[02:00:33] <Boomtime> perhaps there are some other use cases too, but generally you don't need $and
[02:10:59] <xack-work> Yeah, that worked fine. I see it now.
[02:11:18] <xack-work> due to the $in being wrapped, I messed up the worker.id part. Makes sense.
[02:12:17] <xack-work> now to convert it to go mgo.. wee.
[02:24:07] <xack-work> trying to make a findAndModify command, returns an error The dotted field 'worker.id' in 'worker.id' is not valid for storage.
[02:24:27] <xack-work> when you guys debug query issues, i assume you hit the cli and manually hit it that way?
[02:25:37] <xack-work> i turned on verbose mode (db.setProfilingLevel(2)) and see dumps of queries, but most that junk isn't easily copy pasted into cli.. getting myself acclimated to the new environment. :)
[02:28:05] <cheeser> field names can't have dots in them.
[02:29:11] <xack-work> my use case above is that i'm trying to place inside a document a worker field, and inside that an id field, hence worker.id
[02:30:18] <joannac> should be {worker: {id: ...}}
[02:54:09] <sabrehagen> does anybody have any tips for my problem above?
[02:57:45] <xack-work> before i jump too heavily, findAndModify should only modify the field noted in the change, not REMOVE all other document data and only place the change data.. right? heh
[03:04:14] <joannac> xack-work: depends what the update part looks like
[03:07:21] <Boomtime> @sabrehagen: why don't you use a single date range?
[03:07:47] <Boomtime> also, you don't need any of those $and
[03:07:55] <Boomtime> predicates are 'and' by default
[03:08:43] <sabrehagen> i think i can't use a single date range because i need to know if their logs are in week 1, week 2, and week 3, not just anywhere between week 1 to week 3
[03:14:24] <sabrehagen> and on that premise, that's why i used the multiple $ands
[03:19:07] <Boomtime> so how are you going to tell whether they are in week1 and not week2?
[03:19:20] <Boomtime> you run a single query.. you get back a single contiguous stream os results
[03:20:04] <Boomtime> if you want them grouped by which week they fall into, you need to either use aggregation to generate a specific grouping, or run 3 queries
[03:20:32] <sabrehagen> no need to group them by week, just know if the conditions were met or not
[03:20:51] <Boomtime> yeah.. and when you run that query, and the 'conditions' are met?
[03:21:11] <Boomtime> the 'conditions' you have stipulated are "in week1 AND in week2" - you'll get back nothing right?
[03:21:48] <Boomtime> so even if you want multiple ranges for that fate field, you'll need a $or
[03:22:42] <sabrehagen> i don't believe so. i have server logs where each has a user recorded against each log, so in week one and week two should be fine, both can hold true
[03:22:44] <Boomtime> but let's say you run a query with "in week1 OR in week2" -> now what? the results are indistinguishable from "in the fortnight X"
[03:23:48] <Boomtime> aren't you using _id as the date field?
[03:23:55] <Boomtime> can you re-paste your query here
[03:24:51] <sabrehagen> i wrote it in irc, so it's rough
[03:24:57] <sabrehagen> something like { $and : [ { $and : [ { user : 'username' }, { _id : { $gt : from1 } }, { _id : { $lt : to1 } } ] }, { same $and object as before but with from2, and to2 } ] }
[03:25:14] <sabrehagen> i agree i can drop the inner $and, something like...
[03:25:52] <Boomtime> you can drop all the $and, there is no reason for any of them, you'll get the same results with or without them
[03:26:09] <sabrehagen> { $and : [ { user : 'username', _id : { $gt : from1, $lt : to1 } }, { same $and object as before but with from2, and to2 } ] }
[03:26:12] <Boomtime> note as it is, the result won't be parseable because of duplicate _id
[03:34:04] <Boomtime> if your three date ranges are contiguous then the query you have is no different from querying for from1 through to to3 a single match
[03:34:31] <Boomtime> i.e if to1 == from2 then you may as well coalesce them
[03:35:34] <sabrehagen> wouldn't that return results where one log entry was found in any of the three weeks, essentially a $or not a $and?
[03:36:19] <Boomtime> what do you think you'll get back right now?
[03:36:30] <Boomtime> i postulate that you cannot possibly get any results right now
[03:39:35] <Boomtime> and you want to know which instances of 'username' where there are at least 3 documents, where each of those _id is a date that occurs in 3 particular weeks
[03:39:50] <Boomtime> one each of three particular weeks
[03:43:28] <sabrehagen> i'd like to know which users, not just how many :)
[03:43:43] <Boomtime> ah, then you will need aggregation
[03:44:10] <Boomtime> this is not a task for the faint hearted - and i'm not going to teach you aggregation here - i would suggest reading through the docs, and trying a few basic things first
[03:44:35] <Boomtime> things to familiarize yourself with are $group
[03:46:09] <Boomtime> there's probably a couple different ways to do this actually, but if you play with $match and $group[ to start with you can ask here for further help once you understand those
[03:46:16] <sabrehagen> thank you very much, your assistance has been great!
[12:52:14] <deathanchor> newbsduser: use a script for more controls: var dbo = new Mongo().getDB('test'); var dbarray = dbo.adminCommand('listDatabases').databases;
[12:52:34] <cheeser> what does "not working" mean?
[12:55:04] <newbsduser> actually i tried to use javascript deathanchor but i dont want to parse json output... can i get another output rather than json with javascript command
[13:45:30] <deathanchor> newbsduser: learn some javascript, you can print out any format you want.
[15:04:40] <mawe> I imported a dump from v2.2.3 to v2.6.9 and now db.stats().dataSize has nearly doubled, is this because of the 255 vs 256kbyte size of the chunks collection?
[15:08:11] <cheeser> might be related to this: http://docs.mongodb.org/v2.6/core/storage/#power-of-2-sized-allocations
[15:13:02] <mawe> yes I found this, https://jira.mongodb.org/browse/SERVER-13331, I'm wondering if it will shrink if I store it again with the new version
[15:47:59] <StephenLynx> when I connect using ssl by adding ssl=true in the url, am I required to provide a certificate and a key to the server?
[15:48:10] <StephenLynx> mongodb://hostname:27017/test?ssl=true for example
[16:08:56] <steeze> when using the aggregation pipeline with $group and the $push accumulator
[16:09:14] <steeze> if i have to properties using $push, can i assume the indices in those array will match what records they came from?
[16:09:23] <steeze> like, they get stuffed in the same order?
[16:46:50] <jr3> can anyone think of why a multi update that drops a lot of data on a collection reports no data size change via collection.stats()
[18:52:45] <jr3> If I promote a primary to a secondary to do work on it, then promote it back to primary afterwards will the secondary sync back to primary once it's back up
[18:53:30] <n0arch> they will sync from eachother depending on which is the primary
[18:54:09] <jr3> my concern is I want any new records to go back up to the primary once it gets restored
[18:56:13] <n0arch> when you step the primary down, the new primary will accept your writes
[18:56:23] <n0arch> while its a secondary it will sync those writes
[19:00:44] <tejasmanohar> oh i thought $in didnt work with string equality, maybe i'm wrong
[19:01:58] <cheeser> i've never heard anything along those lines
[19:20:40] <honken> hey! started testing MongoDB today, and i like it alot, thou having some problem finding examples of different stuff, mainly php reference code, anyone have a good source?
[19:21:13] <StephenLynx> not using PHP is an option?
[20:13:03] <steeze> there's a jira issue out there someone calling for partial text matching with $in. boy howdy would that have helped me last month
[20:13:27] <steeze> ended up building a crazy looking query with regex and indexed fields, still not as powerful as it could have been with partial matching for $in though :/
[20:38:27] <amitprakash> Hi, wheneever I specify a readPreference=primaryPreferred/secondaryPreferred against MongoClient, I keep getting a ServerSelectionTimeoutError: No replica set members match selector "<function any_server_selector at 0x7f8de97a7bf8>" at random
[20:38:32] <amitprakash> How do I resolve this issue?
[20:54:57] <honken> figured it out, thanks for all the respons :)
[21:17:31] <mikeatgl> I've recently experienced Mongo crashing with a really simple API. Before the log ends it says there were over 3800 connections now open. That seems like way too much. I'm using db.close() on my callbacks. Is that a normal number of connections? The DB is probably only getting a hundred hits a week right now at most.
[21:18:56] <mikeatgl> It had been running with no problems for a couple weeks and all of a sudden won't stay up. No changes were made to the Node script or Mongo version as far as I know. The only thing I could see is that connection number kept going up and up.
[22:28:26] <amitprakash> Anothing thing I'm seeing is that MongoDB is taking a lot of time to return all the results (49s) via pymongo when I can fetch them directly almost instantaneously when querying the db using the mongo client
[22:32:39] <Boomtime> @amitprakash: 'all the results' is how many roughly?
[23:12:38] <amitprakash> gets the next batch of results
[23:16:01] <Boomtime> @amitprakash: and in your python code, how do you know you're measuring the driver and not how long it takes python to insert 5000 items into a dynamic array?
[23:22:45] <Boomtime> remove the lst.append and just increment a counter - the driver is forced to retrieve the doc from the server, but python doesn't have to do anything with it