PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Tuesday the 7th of July, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[02:18:03] <topwobble> how can I tell if a secondary is up to date with the primary? I just had it offline for 3 hrs and need to know when it is synced
[02:19:10] <topwobble> it seems like it is serving read requests, which I am worried about since i know it cant be up to date
[02:20:06] <Boomtime> rs.printSlaveReplicationInfo()
[02:20:46] <Boomtime> also, read only from the primary if you can't tolerate stale reads
[02:20:57] <Boomtime> (this is the default by the way)
[02:22:58] <topwobble> im down shit creek after following advice from a mongo employee. great
[02:23:29] <topwobble> Boomtime my secondary is too out of date. How do I do an initial sync?
[02:30:38] <Boomtime> topwobble: do you have a support contract?
[02:30:49] <topwobble> Boomtime yes
[02:31:05] <Boomtime> you should raise a ticket
[02:31:28] <topwobble> i did, but trying to not wait a day until i can try to fix this.
[03:49:46] <pylua> how to perform bulk operations ?
[03:50:44] <cheeser> depends on the driver
[04:06:05] <cphoover> Hello I'm working with the node.js mongo driver. I am operating on a cursor. What I want to do is skip an arbitrary number of documents in a collection then read the next object and then skip a number of documents then read the next object... When I attempt to do this I get the error "MongoError: Cursor is closed" maybe I'm misunderstanding 'skip' but can it not be used after the cursor has been moved?
[04:09:59] <pylua> cheeser:pymongo
[04:10:50] <cheeser> http://api.mongodb.org/python/current/examples/bulk.html
[04:11:45] <Boomtime> cphoover: yeah, that isn't very clear but skip() is actually part of the command that went to the server - you only get to use it at the start, once you start consuming the results, that method is not available
[04:12:03] <pylua> cheeser: I only need one doc returned at each find
[04:12:10] <Jonno_FTW> I have a problem, I can connect to a local instance of mongodb, but I can't connect to it remotely even though I used the same command line params
[04:12:19] <Boomtime> treat skip() as an addendum to the query (because it is), you can only issue it once
[04:12:29] <Jonno_FTW> I always get auth failure
[04:12:38] <cheeser> Jonno_FTW: make sure you're not starting on localhost rather than 0.0.0.0
[04:12:48] <cheeser> ah
[04:13:28] <Boomtime> heh, yeah :p , 'auth failure' not connect failure... might be the localhost exception which cares not about auth attempts with no users present
[04:13:31] <Jonno_FTW> I only have security.auth enabled in the config
[04:13:50] <Boomtime> have you created any users?
[04:13:53] <Jonno_FTW> yes
[04:14:02] <pylua> how could I delete on doc with cursor ?
[04:14:03] <Jonno_FTW> connecting using that user works locally
[04:14:20] <Boomtime> you are connecting via the mongo shell?
[04:14:24] <Jonno_FTW> yes
[04:14:33] <Boomtime> and remotely, with the mongo shell and the same command line?
[04:14:33] <pylua> Jonno_FTW:how does the mongo log sayes
[04:15:00] <Jonno_FTW> Failed to authenticate penny@pennyParking with mechanism MONGODB-CR: AuthenticationFailed MONGODB-CR credentials missing in the user document
[04:15:18] <Boomtime> what is the server version?
[04:15:31] <Jonno_FTW> 3.1.5
[04:15:44] <Jonno_FTW> shell version is 2.4.9
[04:15:52] <Boomtime> yep, i guessed already :p
[04:15:54] <cphoover> Boomtime: Ok thanks for the quick reply. So is there no way to do that? Or perhaps I just need to issue several distinct queries
[04:16:03] <Jonno_FTW> so I need a new shell?
[04:16:05] <Boomtime> yep
[04:16:18] <Boomtime> your new server defaulted to using SCRAM-SHA1 for the user creds
[04:16:27] <Boomtime> which the old shell can't do at all
[04:16:50] <Boomtime> you could knock the server down to using MONGODB-CR but you're better off moving into the future than into the past
[04:17:00] <Jonno_FTW> yeah I'll update my client
[04:17:08] <Boomtime> good choice :-)
[04:17:11] <Jonno_FTW> is there a gui client that works with 3+?
[04:17:39] <Boomtime> i'm not sure.. just check for SCRAM-SHA1 support - it's the only thing that will be a roadblock
[04:17:50] <pylua> how could I delete one doc with cursor ?
[04:18:10] <Boomtime> pylua, you issue a remove on the collection, specify the _id of the doc you want removed
[04:18:23] <Boomtime> a cursor is a reader only, it can't directly delete docs
[04:26:05] <Jonno_FTW> an ncurses client for mongo would be nice
[04:37:17] <limbera> would anyone here know if parse.com (which uses mongodb) are encrypting their BSON files?
[04:38:16] <cheeser> to my knowledge they aren't. they're mostly on mmapv1 with about 25% on MongoDB/RocksDB
[04:38:37] <cheeser> not sure about the rocks file storage system but mmapv1 doesn't support encryption at rest.
[04:38:47] <cheeser> they'd have to rely on the OS/filesystem capabilities.
[04:39:06] <limbera> is Mongo/Rocks encrypted
[04:39:07] <limbera> ?
[04:39:26] <cheeser> i don't think so
[04:39:41] <limbera> hmmm i see
[04:39:58] <cheeser> check the website, though. i only have a passing knowledge of the rocksdb storage system
[04:39:59] <limbera> how is relying on OS/files system auth/security any different from doing the same with an SQL variant
[04:40:12] <cheeser> it's not.
[04:40:14] <limbera> yeah i've scoured the internet and no mention of encryption so i think you're right
[04:40:19] <limbera> gotcha thanks cheeser
[04:41:07] <cheeser> np
[07:21:26] <nickenchuggets> having a problem with mongodb, I gathered some details from syslog, https://gist.github.com/brlafreniere/cd7b291ac9ece484e48f
[07:21:33] <nickenchuggets> on 64 bit Debian
[07:24:19] <nickenchuggets> oh, well, I may have discovered the problem... I'm on Debian 8 :P
[07:25:36] <nickenchuggets> that... kinda sucks, the apt repo that mongodb provides appears to be compatible only with Debian 7
[07:34:59] <nickenchuggets> is mongodb 2.4.10 horribly out of date?
[07:37:17] <nickenchuggets> I tried to install mongodb via the 3rd party apt repos, which is said to be for debian 7 wheezy, yet I'm using debian 8 jessie... and I'm getting all kinds of errors and stuff, so I'm guessing that's not gonna work...
[07:39:00] <nickenchuggets> alright, so I downloaded the binaries instead
[07:56:42] <tejasmanohar> hey
[07:56:47] <tejasmanohar> is there any way i can force an _id field
[07:56:52] <tejasmanohar> even if not recommended, i just want to test 1 thing
[07:57:44] <tejasmanohar> not prod code
[08:01:26] <coudenysj> tejasmanohar: what do you mean? you want to set the value yourself?
[08:01:34] <tejasmanohar> coudenysj: yes
[08:01:54] <tejasmanohar> normal insert ok? coudenysj
[08:02:29] <coudenysj> you can just insert a value you want
[08:02:39] <coudenysj> if you do not, mongo will create one for you
[08:03:43] <Boomtime> tejasmanohar: what is not recommended? if you have a value in your document structure that is unique and already exists, you should totally use it as the _id field
[08:04:04] <Boomtime> _id is populated for you, only if you do not supply one
[08:04:34] <the_voice_> Question
[08:04:44] <Boomtime> if you don't supply it (or use the value that is supplied for you), then there's a whole indexed field, of 12 bytes per document that exists for no reason
[08:04:59] <nickenchuggets> yay, I solved my issue
[08:06:28] <the_voice_> users.update({column6: { $elemMatch: { _id: id } } }, {$set: { "friends.$.name" : name } })
[08:06:34] <the_voice_> Would that be slow or no?
[08:06:53] <the_voice_> users.update({friends: { $elemMatch: { _id: id } } }, {$set: { "friends.$.name" : name } })
[08:06:55] <the_voice_> sorry it should be that
[08:07:13] <the_voice_> I am new to mongo and trying to understnad if searching a subdocument like that would have any performance implications
[08:08:12] <Boomtime> the_voice_: nothing is slow if it has a covering index, the further from being covered by an index that a query gets, the slower it gets
[08:09:22] <the_voice_> okay thanks
[08:09:47] <the_voice_> I just realized though it;s only updating one row and not another row where that element exists in an array :(
[08:10:33] <bogn> did you use the multi flag?
[08:10:50] <the_voice_> no, but I just removed the first document
[08:11:01] <the_voice_> it is not updating the second document as it has more than one element in the array
[08:11:18] <the_voice_> only one with the _id: id but for some reason it is not working
[08:11:27] <bogn> so it's not updating a second embedded document
[08:11:48] <bogn> from an array of embedded documents
[08:11:53] <Boomtime> only one entry of an array is updated - the $ operator can only address a single match
[08:12:05] <the_voice_> right but there is only one match
[08:12:10] <the_voice_> you can't have a duplicate
[08:12:16] <the_voice_> one sec let me see if I can figure this out
[08:12:48] <bogn> so it's simply updating the first embedded document, how many levels is that deep?
[08:13:36] <Boomtime> according to your query, it's one
[08:14:11] <Boomtime> your document must look something like this: { friends: [ { _id: ... }, { _id: ... } ] }
[08:14:14] <Boomtime> right?
[08:14:49] <Boomtime> the sub-document which caused that document to be matched in the predicate, is the one that will get addressed by $
[08:15:21] <the_voice_> yah got that to work right now
[08:15:22] <the_voice_> thanks :)
[08:16:35] <the_voice_> Boomtime you spoke about indexing previously
[08:17:01] <the_voice_> if you index an array hten it automatically indexes both columns of the subdocument or you index both the array and the _id part of the subdocument
[08:17:59] <Boomtime> what are columns?
[08:18:09] <Boomtime> can you provide an example?
[08:18:18] <the_voice_> the same as I showed above
[08:18:23] <the_voice_> so in the users table
[08:18:25] <Boomtime> when you index an array, the precise values of that array are what get indexed
[08:18:51] <the_voice_> I would have friends [{_id:...., name:....}]
[08:19:02] <the_voice_> *friends:
[08:19:12] <Boomtime> what did you index?
[08:19:17] <the_voice_> as one of the columns, but Iw ould want to index that array and be able to search by _id
[08:19:36] <the_voice_> I haven't yet I am working in dev so none of my tables have more than 10 entries right now :) I want to know how I should index that
[08:20:19] <Boomtime> if you want to search by the _id field inside the subdocuments, you need to index that -> ensureIndex( { "friends._id" : 1 } )
[08:21:32] <the_voice_> okay cool
[08:21:33] <the_voice_> thanks
[08:21:42] <the_voice_> that was what I thought just wanted to make sure
[08:22:12] <Boomtime> np :)
[08:43:36] <synthmeat> hey. my mongodb says that avgObjSize is 1157
[08:43:50] <synthmeat> what is "object" and what is "1157" here?
[08:44:01] <synthmeat> object = document?
[08:47:49] <synthmeat> (i'm trying to predict my memory requirements for mongo, presuming known concurrent load and document sizes)
[08:58:29] <synthmeat> ok, the numbers are B, found that. and objects are indeed documents
[09:18:50] <iszak> How do I explain an aggregate in Mongo 2.4? .aggregate().explain() doesn't work
[11:54:14] <deathanchor> iszak: why are you explaining an aggregation?
[12:06:58] <iszak> deathanchor: so I know where the bottleneck is
[12:10:53] <the_voice_> Is there a way to set a value of a field in a document as the result of an aggregate of one of the subdcuments?
[12:12:36] <the_voice_> so for instance if I had a document user= {_id:1, name: bob, friends: [{_id:2, name:dave},{_id:3, name:jo}]}
[12:13:14] <the_voice_> is there a way I could do an update that would create a third column from the subdocuments that was called friendsList: "dave,jo"
[12:13:20] <StephenLynx> I wouldn't use _id in subdocuments.
[12:13:36] <the_voice_> In this case I need it because I am referencing another document
[12:13:38] <StephenLynx> it would be confusing in the application code.
[12:13:56] <StephenLynx> since _id from documents has special behavior
[12:14:05] <StephenLynx> you don't need.
[12:14:18] <StephenLynx> you can call it w/e you want.
[12:14:25] <the_voice_> ah okay
[12:14:27] <the_voice_> so call it id:
[12:14:38] <StephenLynx> I would make it more explicit.
[12:14:44] <StephenLynx> but w/e floats your goat.
[12:15:00] <StephenLynx> "is there a way I could do an update that would create a third column from the subdocuments that was called friendsList: "dave,jo"'
[12:15:03] <StephenLynx> what do you mean?
[12:15:21] <StephenLynx> add a new subdocument to the friends subarray?
[12:15:27] <the_voice_> I mean i need to concatanate all of the names
[12:15:33] <the_voice_> and make it into a new column
[12:15:33] <StephenLynx> hm
[12:15:39] <the_voice_> and I need to do it in a single update
[12:15:48] <StephenLynx> I don't think so.
[12:15:51] <the_voice_> it's not for the exact case above but a similar one.
[12:16:59] <the_voice_> okay thank you
[12:17:04] <the_voice_> so I will work on another solution :)
[12:17:35] <StephenLynx> what if you add it when you add the subdocument?
[12:17:47] <StephenLynx> afaik, there is a concatenation operator for update
[12:17:53] <the_voice_> the issue is when I update the subdocument
[12:17:56] <StephenLynx> ah
[12:18:04] <the_voice_> that's why I need the id
[12:18:11] <the_voice_> so I can update it in the event a name changes
[12:18:22] <StephenLynx> why do you need this string with the names?
[12:19:50] <the_voice_> http://docs.mongodb.org/manual/applications/data-models-tree-structures/
[12:19:53] <the_voice_> we are doing something like that
[12:19:55] <the_voice_> for categories
[12:20:04] <the_voice_> it's not users just it is easier to explain that
[12:20:28] <the_voice_> anyways for typeahead I want to be able for them to start with parent then the next one etc...
[12:20:36] <StephenLynx> what I would do:
[12:20:37] <the_voice_> With the plugin we are using it would have been easier that is all
[12:20:55] <StephenLynx> when displaying the categories, I would perform a single query with the array of ids
[12:21:05] <StephenLynx> so I would have in a single operation all of the categories names
[12:21:14] <StephenLynx> without worrying about updating them
[12:21:49] <StephenLynx> categories.find({_id:{$in:object.categories}})
[12:22:38] <the_voice_> (y)
[12:23:12] <StephenLynx> what I actually do is to have a displayable name as its unique id.
[12:24:03] <StephenLynx> so I don't have to do even that. But I reckon that is not a viable solution when you may have multiple objects with the same readable name.
[12:26:44] <adsf> is this a normal way to do mutliple in's?
[12:26:47] <adsf> collection.find(and(in("commented", false), in("posted", true))).iterator();
[12:26:57] <adsf> or should i split them out somehow?
[12:27:31] <StephenLynx> that sounds reasonable.
[12:27:38] <adsf> thanks!
[12:27:41] <StephenLynx> you want x that is in list 1 but not on list 2
[12:28:09] <StephenLynx> just be aware you can use $nin
[12:28:16] <adsf> do you mean mean StephenLynx ?
[12:28:26] <StephenLynx> what driver you use?
[12:28:30] <adsf> i am after documents where commented is false and posted is true
[12:28:34] <adsf> java 3
[12:28:56] <StephenLynx> that is the syntax of the driver?
[12:29:13] <StephenLynx> you always use in but specify after if its in or not?
[12:29:20] <StephenLynx> the default syntax is using in and nin
[12:29:46] <adsf> i want in for both
[12:30:07] <StephenLynx> no, you want not-in for the first.
[12:30:19] <StephenLynx> oh, wait.
[12:30:31] <adsf> :p
[12:30:38] <StephenLynx> commented and posted are fields in the documents?
[12:30:43] <adsf> correct
[12:30:45] <StephenLynx> aaah
[12:30:50] <adsf> boolean values
[12:30:51] <StephenLynx> then your query is bollocks
[12:31:01] <StephenLynx> you just use field:value
[12:31:11] <StephenLynx> commented:false, posted:true
[12:31:13] <StephenLynx> just that.
[12:31:18] <adsf> perfect
[12:31:20] <adsf> lemme try it out
[12:31:22] <adsf> thank you :)
[12:32:02] <StephenLynx> and thinking about that, I was wrong about it being reasonable for two in's too.
[12:32:08] <StephenLynx> but nevermind that.
[12:32:28] <adsf> hehe
[12:32:38] <adsf> just need to see how i can use that syntax in java
[12:32:58] <StephenLynx> look at the driver documentation.
[12:33:07] <StephenLynx> afaik the java driver was the very first driver developed.
[12:33:21] <adsf> yeah, im just opening it now
[12:33:22] <StephenLynx> so I would expect it to have a pretty good documentation
[12:33:39] <adsf> it is fairly good :)
[12:33:55] <adsf> but as a noob you can always twist what the doco says into something not all that good :
[12:36:12] <StephenLynx> :V
[12:52:14] <leporello> Hello. Who's using mongoose? How to make a query inside of pre('save') trigger?
[12:52:41] <StephenLynx> hopefully, no one.
[12:52:48] <StephenLynx> mongoose is cancer coded.
[12:53:12] <EXetoC> :p
[12:54:18] <leporello> self.constructor.find do what I need.
[12:54:21] <leporello> Ok.
[13:02:43] <pylua> how to convert datetime to ISO date? Must mongodb use ISO date ?
[13:03:01] <cheeser> typically, the driver will do that conversion for you.
[13:04:00] <pylua> cheeser:how does pymongo do that ?
[13:04:06] <cheeser> it should, yes.
[13:05:23] <pylua> cheeser:Actually,I mean how do I create a ISO date with python datetime ?
[13:05:47] <pylua> or what the diff of ISO date and datetime ?
[13:06:00] <cheeser> i'm not sure (i'm not a python guy) but you should just be able to put a python date in your document and the driver should convert it for you
[13:07:13] <pylua> cheeser:I usually need to do query at mongo shell command line ,so I need to use ISO date instead
[13:07:49] <pylua> but mongo shell can not recgnize datetime
[13:07:59] <cheeser> in java, we just use java.util.Date and the driver converts. pymongo should do the same.
[13:08:08] <EXetoC> yeah
[13:16:08] <pylua> what is the format of mongo;s iso date?
[13:27:51] <jecran> Hi guys. How can I wait for all my mongo processes to finish so I can exit my program? It currently just hangs, and I dont have an option to manually close, because I have no idea when its done lol
[13:28:07] <cheeser> "lol" ... what?
[13:28:35] <jecran> I have read that node closes the mongodb connections manually. But mine are not closing, and my node application does not exit when done
[13:28:51] <cheeser> ah. node. dunno.
[13:29:24] <jecran> how about just mongo, is there maybe something that can tell me when the connections are closed, or when they are done connecting online?
[13:30:32] <cheeser> db.currentOp(true)
[13:31:23] <jecran> yeah just found it thanks will play with it now
[13:34:43] <StephenLynx> afaik, it doesn't close connections manually in most cases.
[13:35:01] <StephenLynx> I have to close them when I want it to finish by itself.
[13:35:05] <puppeh> is the ruby mongo driver (v2) compatible with mongo 2.4 ?
[13:35:10] <puppeh> I don't see any mentions of the compatibility
[13:35:11] <StephenLynx> jecran
[13:35:25] <StephenLynx> it doesn't close connections automatically*
[13:35:43] <jecran> no, no it doesn't :P
[13:36:23] <StephenLynx> but when I close the connection, io realizes it and shuts down. assuming nothing else is hanging.
[13:37:30] <jecran> When I try to close my connection, I miss out on about 5-10 records out of 100 .. even using callbacks
[13:38:19] <StephenLynx> then you need to check your code.
[13:39:02] <StephenLynx> these records, are they from requests?
[13:39:07] <StephenLynx> external requests?
[13:40:33] <jecran> StephenLynx: yes... rss feeds
[13:40:37] <StephenLynx> ok
[13:40:44] <StephenLynx> so you need to
[13:40:48] <StephenLynx> 1- stop incoming requests
[13:41:03] <StephenLynx> 2- realize when all pending requests are through
[13:41:06] <StephenLynx> 3- close the connection
[13:41:49] <jecran> 2 ---- the tricky one . I can tell when I am done reading the rss feeds, at which point mongodb is still a few records back, and I don't know how to tell when its down
[13:42:02] <jecran> done*
[13:42:19] <StephenLynx> I would first check if there is any kind of tool for that in node/io.
[13:42:37] <StephenLynx> if not
[13:43:10] <jecran> I use wtfnode currently, which lets me know that I have the connections still open. Handy little tool
[13:43:15] <basiclaser> I'm making a dictionary web application. It serves a list of words, based on a string search, and the word definitions along with synonyms. I want the user to be able to request 'tiger' and then also recieve 50 words before and after that word, alphabetically. The user can request two different versions of the dictionary, one with certain words removed.
[13:43:16] <basiclaser> Which, if any, database and distribution system could/should I use in the backend express app to store and distribute the dictionaries? Is there an optimal way of loading subsections of a list of words like this? I currently have the words stored in files in javascript arrays.
[13:43:44] <StephenLynx> then I would have all my incoming requests and outgoing responses funnel through a single place, put a simple counter of active requests, if the flag of shut down is true and no more pending requests are pending, shut the worker down.
[13:44:37] <StephenLynx> there is even an event for when a requests is completed.
[13:44:53] <StephenLynx> one for when it is killed before response and another for when you finish it.
[13:46:22] <jecran> ok cool... thanx for the help
[13:54:52] <jecran> StephenLynx: my simple solution is: check the error, if the error tells me the sockets are closed, reopen the connection. Not efficient, but no counting and only used on the last few results
[13:55:06] <StephenLynx> the problem is
[13:55:16] <StephenLynx> by the that time you already dun goofed :v
[13:55:30] <StephenLynx> plus lots and lots of additional code.
[13:55:43] <StephenLynx> you would have to either duplicate that check or abstract that.
[13:56:07] <jecran> lol I tried the counting. It hits 0 alot, thats all im saying :P
[13:56:14] <StephenLynx> welp
[14:02:00] <jecran> StephenLynx: worked like a charm! 100% results as expected
[14:21:46] <puppeh> does this info still stands for the version 2 ruby driver? https://github.com/mongodb/mongo-ruby-driver/wiki/Replica-Sets#recovery
[14:49:14] <makzen> Hello, I have a last_active date and a created date in my collection documents. I want to find all entries where last_active and created are not on the same day. Can somebody give me a hint?
[16:37:15] <lmatteis> hi all. i have inherited a codebase which seems to run aggregate functions every day or so
[16:37:31] <lmatteis> i'm wondering though, can i have mongodb generate them automatically for me?
[16:37:46] <lmatteis> like for example in couchdb, all you need is the view, and it updates automatically when the data changes
[16:38:25] <cheeser> generate what now?
[16:39:09] <lmatteis> cheeser: these aggregate
[16:39:12] <lmatteis> *aggregates
[16:39:21] <cheeser> generate them from what?
[16:39:46] <lmatteis> just a bunch of documents from collections
[16:40:59] <cheeser> well, you run your pipelines and write out the results... cron that job and you're done.
[16:41:29] <StephenLynx> mongo won't schedule operations, from what I know.
[16:41:29] <lmatteis> cheeser: but like i said, do i need a cron job?
[16:41:43] <cheeser> *something* has to schedule those runs
[16:41:48] <lmatteis> why
[16:41:52] <lmatteis> couchdb doesn't have that
[16:41:54] <StephenLynx> because isn't implemented.
[16:42:00] <cheeser> this isn't couchdb...
[16:42:09] <lmatteis> fine
[16:42:11] <cheeser> there's no scheduler built in to mongodb
[16:43:21] <joelkelly> anyone have any experience with populate on mongoose? Trying to figure out if it needs to be established when the data is passed in or if it can be used on existing documents
[17:05:15] <symbol> I'm still trying to wrap my head around proper use cases and schema design in Mongo...it seems to be that Mongo would not be a good choice for something like twitter, correct?
[17:05:48] <StephenLynx> depends.
[17:05:50] <symbol> Followers/following probably can't be embeded since the size can grow to large numbers at times.
[17:05:59] <StephenLynx> it could be done.
[17:06:06] <StephenLynx> but many features wouldn't get in.
[17:06:16] <symbol> Can you expand on that idea?
[17:06:23] <StephenLynx> for example
[17:06:48] <StephenLynx> the linked people in tweets is dynamic, probably because it uses a join or something.
[17:06:58] <StephenLynx> if one changes its handle
[17:07:05] <StephenLynx> the tweet changes
[17:07:05] <StephenLynx> right?
[17:07:14] <symbol> I believe so
[17:07:25] <StephenLynx> I wouldn't allow for people to change its handle
[17:07:27] <StephenLynx> for example
[17:07:43] <StephenLynx> of a feature that I wouldn't include if I were to implement it with mongo.
[17:07:47] <cheeser> which twitter doesn't, i believe
[17:07:54] <StephenLynx> doesn't?
[17:07:58] <StephenLynx> let me check
[17:08:04] <symbol> I'm also checking, heh
[17:08:06] <cheeser> you can change the display name but not the @ name, iirc
[17:08:36] <StephenLynx> my username is not my display name
[17:08:37] <symbol> Looks like it doesnt
[17:08:39] <StephenLynx> and it lets me change it
[17:08:49] <cheeser> oh. fair enough.
[17:08:50] <symbol> Someone referred to be in their tweet and it dead ends
[17:09:01] <StephenLynx> it lets you change
[17:09:11] <StephenLynx> ah, so the tweets don't change?
[17:09:14] <symbol> Nope
[17:09:26] <StephenLynx> so I was half-right
[17:09:36] <symbol> Heh, good example none-the-less
[17:09:44] <symbol> Not sure why I dashed that.
[17:09:55] <StephenLynx> the following/followers could be pre-aggregated.
[17:10:09] <StephenLynx> but indeed
[17:10:28] <StephenLynx> it would grow really large if you were to put in an embedded arra
[17:10:38] <StephenLynx> in general, yeah, mongo wouldn't fit it very well.
[17:10:55] <StephenLynx> but is not the worst scenario, either :v
[17:11:19] <symbol> I feel like every resource I've been studying talks about mongo and its speed with big data...so it seems that it's mostly good with big data that can be embedded.
[17:11:41] <StephenLynx> or isn't very related.
[17:12:09] <StephenLynx> I have been using mongo for a year now on forum-related projects.
[17:12:12] <StephenLynx> fits like a glove.
[17:12:20] <StephenLynx> because most relations are 1-n
[17:12:43] <StephenLynx> so its easy to either make it an embedded array or to use fake relations.
[17:13:00] <symbol> Parent has many comments sort of thing?
[17:13:09] <StephenLynx> no.
[17:13:20] <StephenLynx> parents ignore completely their children.
[17:13:29] <StephenLynx> aah
[17:13:33] <StephenLynx> yeah, that
[17:13:42] <StephenLynx> board has many threads, threads has many replies
[17:13:57] <StephenLynx> user owns many boards
[17:14:14] <StephenLynx> for small stuff I use subarrays, like settings of a board
[17:14:37] <symbol> Are "board has many threads, threads has many replies" fake relations?
[17:14:41] <StephenLynx> yes
[17:14:54] <symbol> user owns many boards as well?
[17:14:57] <StephenLynx> aye
[17:15:19] <StephenLynx> the user just have an array of owned boards that is pre-aggregated.
[17:15:42] <StephenLynx> and the board has its owner in a field.
[17:15:46] <symbol> What do you mean by pre-aggregated? You have a background job handling that?
[17:16:07] <StephenLynx> no, I just keep the array of owned boards in the user and update it when it changes.
[17:16:24] <StephenLynx> pre-aggregated is just stuff that you could query for
[17:16:30] <symbol> Gotcha - sorry for the peppering of questions. Trying to get this down pat.
[17:16:40] <StephenLynx> but you instead keep it saved and update accordingly.
[17:16:55] <StephenLynx> np
[17:17:19] <symbol> Gotcha - so you're still needing to do two queries a lot of times?
[17:17:32] <StephenLynx> depends on the case.
[17:17:45] <StephenLynx> in the case of boards owned, the user rarely views this list.
[17:17:55] <StephenLynx> and I would perform a single operation anyway.
[17:18:06] <symbol> Since you already have the user's _id
[17:18:10] <StephenLynx> and this list rarely changes.
[17:18:18] <StephenLynx> no, I don't use relations by _id's
[17:18:29] <StephenLynx> I generally use a readable unique field that I set.
[17:18:53] <StephenLynx> so I can avoid queries for the readable value.
[17:19:14] <StephenLynx> in my forums you can't change a board uri or an account login, for example.
[17:19:21] <StephenLynx> because these are used in fake relations.
[17:19:39] <StephenLynx> and would require manual updating across everywhere they are used.
[17:20:01] <symbol> And that's dangerous
[17:20:04] <StephenLynx> not impossible, but is more stuff to break and stuff.
[17:20:28] <StephenLynx> let me link my latest model
[17:20:37] <symbol> That'd be fantastic, thank you!
[17:20:50] <StephenLynx> https://gitlab.com/mrseth/LynxChan/blob/master/doc/Model.txt
[17:20:53] <symbol> Do you still reap the performance benefits?
[17:21:41] <StephenLynx> yeah, but that is not my focus because these changes would be rare anyway.
[17:22:04] <StephenLynx> like, how often have you changed your twitter handle?
[17:22:12] <symbol> Once :)
[17:22:33] <StephenLynx> so performing these tasks, even if they are really slow, it wouldn't matter.
[17:22:40] <symbol> And that was because of today...heh
[17:22:50] <StephenLynx> either because your load is small or because its so large that it doesn't matter in face of how often you do it.
[17:22:55] <symbol> AH! The lightbulb just clicked.
[17:24:34] <symbol> Thanks for pushing me in the right direction :)
[17:24:42] <StephenLynx> np
[18:13:07] <ab2qik> fdf
[18:14:22] <ab2qik> Hi, can a search be done to find all collections in a db? e.g. use demo. Then do db.find(). Ofc this does not work?
[18:15:00] <StephenLynx> show collections will do that on the terminal, I guess
[18:15:42] <StephenLynx> if you need that on your application, you are probably using dynamic collections, am I right?
[18:20:33] <ab2qik> StephenLynx: just need on cli for the moment. Trying your suggestion now..
[18:20:44] <StephenLynx> then its cool
[18:24:00] <ab2qik> StephenLynx: Perfect, it works, thks!
[18:48:17] <a|i> in a one-to-many relationship where an array of references to ‘many’ is stored on the ‘one’ side, how would pagination work? keep deserializing the reference array from db and pick the next page ids?
[18:49:17] <StephenLynx> hm?
[18:49:42] <StephenLynx> it is much saner to keep the reference to the "one" as a field in the "many"
[18:50:20] <StephenLynx> you can keep the list of "many" as a pre-aggregated field, though.
[18:50:45] <a|i> StephenLynx: http://blog.mongodb.org/post/87200945828/6-rules-of-thumb-for-mongodb-schema-design-part-1 the ‘one-to-many’ option.
[18:51:49] <a|i> the ‘many’ side would be of a few hundred only, but it needs to be paginated by 20 or 30.
[18:52:01] <StephenLynx> again
[18:52:15] <StephenLynx> that is why its easier to have it on the document
[18:52:27] <StephenLynx> have the parent on the document rather than the children on the parent.
[18:52:39] <StephenLynx> sub-arrays can be very limiting.
[18:53:21] <cheeser> there are document growth issues, indexing issues, etc. with arrays
[18:53:25] <a|i> StephenLynx: the article suggest to have the children on the parent when the cardinality is of a few 100.
[18:53:38] <cheeser> i'd build for growth
[18:53:42] <StephenLynx> my experience says the article is bollocks.
[18:53:57] <cheeser> it's a cheap decision that bears dividends down the road
[18:54:14] <StephenLynx> yeah, you can do what the article says, but usually is better not to.
[18:54:20] <StephenLynx> I do both in some scenarios.
[18:54:46] <StephenLynx> in some scenarios I just keep an array of children
[18:55:08] <a|i> with parent on the document, wouldn’t strong consistency be missed?
[18:55:09] <StephenLynx> but usually its better to reference the parent on the children and rely on that.
[18:55:17] <StephenLynx> what do you mean?
[18:56:47] <a|i> I mean some of the replicas are not updated during the query time and querying for a parent may not return all children.
[18:58:42] <StephenLynx> I am not experienced with replicas and clusters, but yes, if it takes some time for that change to be replicated on the children, that would be a possibility.
[18:59:08] <StephenLynx> someone that knows that better might confirm or deny that.
[18:59:51] <StephenLynx> also
[19:00:04] <StephenLynx> notice in the second example in that blog where the author suggests what I suggested.
[19:00:11] <StephenLynx> its all a matter of scale.
[19:00:28] <StephenLynx> if you have few children that rarely change, its better to use the first method. otherwise, the second.
[19:02:20] <cheeser> well, queries should generally hit a primary so that's not a really big problem.
[19:02:37] <cheeser> also, 3.2 will have READ COMMITTED support so should be even less of one.
[19:12:30] <ab2qik> StephenLynx: Hi, getting, "TypeError: undefined is not a function" at ln29 - http://pastebin.com/yMFiNRgp
[19:12:56] <StephenLynx> var db = mongoclient.db('course');
[19:12:57] <StephenLynx> this?
[19:13:15] <StephenLynx> var express = require('express'),
[19:13:20] <StephenLynx> express is a pile of crap.
[19:13:26] <eba> hi all, i've a strange question
[19:13:26] <StephenLynx> I suggest trying without it first.
[19:13:58] <eba> do you know how many people are using mongodb? (any website / article about this?)
[19:14:22] <StephenLynx> no idea.
[19:14:41] <EXetoC> gotta be at least 1000 people
[19:14:43] <eba> i'm on an mongodb app development so looking for the potential users count
[19:14:45] <StephenLynx> not few, from what I heard.
[19:15:26] <eba> EXetoC StephenLynx thnks anyway
[19:15:59] <EXetoC> it's very popular is all I can say, but you've probably noticed already :p
[19:16:14] <ab2qik> StephenLynx: Yes this - var db = mongoclient.db('course');
[19:17:26] <ab2qik> StephenLynx: ok, trying without expressCrap!
[19:27:15] <akoustik> unimportant question: anyone know why the "old" config format is the one used in /etc/mongod.conf in fresh installs, instead of the yaml format? backwards compatibility?
[19:37:10] <cheeser> probably depends on the packager
[19:38:31] <akoustik> probably. just interesting that i've seen it in 4 different distros. (don't ask why i have to use 4 different distros, it's a sad story :)
[19:41:10] <EXetoC> so the server sometimes replies with the key "ok" where the value is of type double instead of int? odd
[20:06:35] <dbclk_> hey guys..need some assistance on an issue i'm trying to figure out with my mongo clusters -> http://pastie.org/10278260
[20:08:21] <akoustik> dbclk_: what exactly is the issue? can't get a replica set running at all, or what?
[20:08:33] <dbclk_> it has
[20:08:43] <dbclk_> I only paste the problem with the one replica set
[20:10:39] <dbclk_> just wondering what's causing it
[20:11:27] <akoustik> sorry, i don't understand what you mean. which lines indicate a problem?
[20:11:54] <akoustik> i assume you're talking about the lines with "replSet info hostdb3.tester.com:xxxxx is down", is that right?
[20:39:55] <BeaverP2> hi there
[20:40:06] <BeaverP2> what is the irc chat for talking to some devs?
[20:45:09] <acidjazz> hey all.. lets say in a document i have a key=>value object, say { objs: { ornage: {}, black: {}, blue: {} } }, what would be the ideal query to pull documents where objs.orange exist?
[20:46:14] <symbol> db.collection.find({"objs.orange" : {$exists: true}})?
[20:48:19] <acidjazz> hmm that seems to work, wonder if thats ideal
[20:48:42] <symbol> Try running explain() on it.
[20:48:51] <symbol> And then try different methods with explain()
[21:14:22] <acidjazz> yea works great thanks
[21:14:29] <acidjazz> i woudlnt know of any other method to try
[21:14:55] <symbol> Yeah, I'm not really sure of other ways. I'm still new myself though ;0
[21:14:57] <acidjazz> symbol: https://gist.github.com/acidjazz/97a07fbe3130527f683d
[21:15:02] <symbol> Meant to do ;)
[21:15:44] <symbol> Adding an index would be helpful if you expect to query it a lot.
[21:32:23] <symbol> Would a many-to-many relationship with references be the one exception to now allowing arrays to be mutable and unbounded?
[21:32:57] <symbol> /s/now/not
[21:45:20] <acidjazz> how about in my collection i have an array of elements
[21:45:33] <acidjazz> and i want to return documents that anything in that array matches a given array
[21:46:05] <akoustik> acidjazz: replace $exists: true with $in: <your array>
[21:46:12] <akoustik> http://docs.mongodb.org/manual/reference/operator/query/in/
[21:46:22] <akoustik> check out the various query operators
[21:58:17] <greyTEO> GothAlice, I am trying to startup a worker.py and an receiving this error "got an unexpected keyword argument 'slave_ok'". Any hints?
[21:58:27] <greyTEO> Could that be a version issue with pymongo?
[21:59:24] <akoustik> greyTEO: are you trying to set slave_okay=True?
[21:59:56] <greyTEO> yes I am
[22:00:01] <akoustik> if so, what happens if you replace that param with "read_preference=ReadPreference.SECONDARY"
[22:00:32] <akoustik> or rather "read_preference=pymongo.ReadPreference.SECONDARY" if you haven't imported ReadPreference explicitly
[22:01:20] <akoustik> i could be totally off base, so, apologies :)
[22:01:46] <greyTEO> well I tried that and now received a new error
[22:01:48] <greyTEO> "got an unexpected keyword argument 'tailable'"
[22:02:09] <acidjazz> akoustik: tanks!
[22:03:50] <GothAlice> greyTEO: Yeah, sounds like you're running the latest Pymongo. You need to pin your dependency <3.0, currently, until MongoEngine is updated.
[22:17:28] <greyTEO> GothAlice, that was it
[22:17:37] <GothAlice> :)
[22:17:37] <greyTEO> pymongo<3.0 fixed it
[22:31:23] <Axy> hey channel I did not specify a folder for mongoexport, where is my export?
[22:31:36] <Axy> I just ran the command mongoexport -d databasename -c collectionname
[22:31:50] <Axy> it just completed successfully but I don't see any files anywhere
[22:33:07] <cheeser> it'd dump out in the current dir
[22:33:18] <Axy> cheeser, hmm I see nothing
[23:49:20] <ab2qik> Hi, get this error after npm install of mongoose, express: Cannot find module '../build/Release/bson'
[23:50:00] <ab2qik> Using mongoose@3.8.31 on ubuntu 14.04