PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Monday the 7th of January, 2013

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:58:37] <timah> am i correct in saying that regardless of content, the default and max document size is 16MB?
[01:04:24] <_aegis_> timah: gridfs?
[01:05:00] <timah> no… i'm not hitting the cap.
[01:05:10] <timah> i want the documents to be smaller.
[01:05:20] <timah> i only store just a tiny bit per document.
[01:05:29] <timah> and that does not fluctuate.
[01:06:02] <timah> but it seems like my document size is consistently 16MB regardless of how little, or how much i stuff into it.
[01:06:10] <timah> or am i missing something?
[01:17:19] <multi_io> is there a way to establish a reader/writer lock in a mongodb database?
[01:18:27] <multi_io> i.e. such that you can perform multiple inserts/updates, all other reads and writes are blocked and don't proceed, but if the lock isn't held, read operations run in parallel?
[01:19:18] <multi_io> (I'm not talking about mongodb's own internal per-database r/w lock -- that one isn't customizable afaics, i.e. you can't make it span multiple write operations)
[01:41:04] <_aegis_> multi_io: sounds like a good way to slow things down :)
[01:41:47] <_aegis_> http://docs.mongodb.org/manual/reference/operator/atomic/ and http://docs.mongodb.org/manual/tutorial/isolate-sequence-of-operations/ ?
[02:18:37] <timah> any idears?
[05:08:47] <yarco> anyone help on my https://gist.github.com/db0fc076ef2c876c6ee4
[05:08:53] <yarco> mongodb + nodejs
[05:09:07] <yarco> seems it stucked there.
[05:09:22] <yarco> but by using db.close(), it will be ok
[05:09:38] <yarco> but then, i dont know when to use db.close...
[07:17:35] <bosyak> hi all. I can't query find() method with Spring Data. Please drop me an example?! mongo.executeCommand("{'find':'firststeps', 'article':'art222'}");
[07:30:10] <Ro__> Hello, I need GridFs with version-able files. After seeing some examples I found that python client has get_version method. Although php driver does not have this method (or I haven)
[07:30:21] <Ro__> Hello, I need GridFs with version-able files. After seeing some examples I found that python client has get_version method. Although php driver does not have this method (or I haven't found any).
[07:47:45] <yarco> when to use ObjectID and when dont have to do so?
[07:54:04] <Oddman> erm, have I done something wrong here?
[07:54:07] <Oddman> $settings = Setting::where_user_id(null)->get(array('setting', 'value'));
[07:54:10] <Oddman> O.o
[07:54:32] <Oddman> returning 0. there's 2 records
[07:55:10] <Oddman> crap sorry, wrong chan
[08:36:55] <[AD]Turbo> hi there
[08:37:06] <drjeats> greetings, earther
[12:06:11] <BadCodSmell> I am using mongo 3bit
[12:06:37] <algernon> that must hurt.
[12:06:40] <BadCodSmell> Occasionally it runs out of memory, I have a fix for this, stop the server, delete the data files, reimport the data, restart the server, restart everything else
[12:07:01] <BadCodSmell> Is there an easy way to trap this error??
[12:07:29] <algernon> do you end up with more than 2Gb of data files?
[12:07:56] <BadCodSmell> yes
[12:08:02] <BadCodSmell> I just rm them and rerun import
[12:08:22] <BadCodSmell> The difficulty is in detecting when mongo enters that condition programmatically
[12:08:26] <ron> wtf is mongo 3bit? :)
[12:08:30] <algernon> http://blog.mongodb.org/post/137788967/32-bit-limitations
[12:08:31] <BadCodSmell> 32
[12:08:36] <ron> oh. 32 bit.
[12:08:39] <algernon> BadCodSmell: ^
[12:08:40] <ron> hehe.
[12:08:48] <BadCodSmell> unfortunately 64 bit is not acceptable
[12:08:54] <BadCodSmell> close source drivers
[12:09:19] <algernon> using capped collections may be an option then
[12:09:48] <algernon> though, hm, since you reimport, capped collections won't really do what you want
[12:09:53] <BadCodSmell> It isn't really a problem with limitations
[12:10:27] <BadCodSmell> It's just is there a good way to trap the error you get outside of the application and mongo when you hit that limit?
[12:54:23] <osallou> Hi, I am trying to call the find method on a connection using python reflexion "db_conn.objklass.find(filter)" but I have errors: TypeError: 'Collection' object is not callable. This works fine if I use db_conn.User.find(filter). Anyway to use a class reference directly?
[12:55:13] <osallou> sorry, wrong room,was expecting mongokit ;-)
[13:57:40] <Virunga> I configured mongodb to listen on port 27017 and accept connection from a comma separated list of ips, and starting the service i get mongodb start/running, process 1804. Is it enough to let the service work?
[13:58:20] <Virunga> Because i can't connect from an other server with ip in the list...
[14:01:13] <Virunga> i can't connect from the host itself either
[14:09:56] <jeremy-> Is it possible to use a $in inside an $or statement
[14:11:11] <jeremy-> perhaps i just have bad syntax
[14:18:19] <timah> jeremy: if i were asking that very same question i would first start by challenging myself in finding a much healthier approach in accessing the data.
[14:22:32] <jeremy-> I doubt there is a healther way, i understand its an expensive query but its designed as opposed to doing an odd few dozen queries instead
[14:23:05] <jeremy-> Ie, against 3 different fields, ($or), search against a user defined array for each ($in)
[14:23:53] <jeremy-> The alternative is to only allow the user to do one of the 3 fields at a time, then it can be indexed, not sure if i want to restrict the user like that
[14:24:11] <timah> jeremy: http://pastie.org ?
[14:25:36] <jeremy-> I thought the above worked, (i could have sworn i got something similar working a few days ago).
[14:25:37] <jeremy-> http://pastie.org/5642799
[14:25:44] <jeremy-> Now when i try and do $in inside $or its not working
[14:28:15] <jeremy-> inside console i get: ReferenceError: $in is not defined (shell):1
[14:28:44] <jeremy-> Cause ive got a test case and its just one line i guess i can paste in here: { $or : [ { "firstfield" : $in ["val1", "val2"] }, {"secondfield" : $in ["val3", "val3"] } ] }
[14:29:15] <NodeX> { $or: [ { foo: {$in:[1,2] }, { bar: {$in:[3,4]} } ] }
[14:29:49] <NodeX> you're missing some parens
[14:29:50] <jeremy-> zzz. i see
[14:29:53] <NodeX> infact typo
[14:29:55] <jeremy-> man i must be tired or something, thanks mate
[14:30:01] <NodeX> { $or: [ { foo: {$in:[1,2] }}, { bar: {$in:[3,4]} } ] }
[14:30:08] <jeremy-> thanks, very helpful nodex
[14:30:15] <NodeX> use that instead ;)
[14:30:17] <NodeX> and you're welcome
[14:30:46] <timah> nodex: nicely done.
[14:31:16] <NodeX> :D
[14:31:23] <NodeX> my brain works on monday's lol
[14:32:12] <timah> coming back from mongo shell and blamo! thunder stolen!
[14:32:27] <NodeX> lol
[14:32:30] <jeremy-> thanks for looking at my issue timah
[14:32:36] <jeremy-> its appreciated all the same
[14:34:37] <timah> jeremy: thank you, but rest assured that next time i'll have finished at least 1 cup of coffee.
[14:34:47] <timah> *pokes* nodex.
[14:34:49] <timah> booger. :P
[14:34:56] <NodeX> :P
[14:54:35] <ichilton> I have a Groups model and I have a need to store 'affiliated groups' - I was thinking of having an array of group id's, but I need to store other details with them, such as the date they were affiliated and an accepted yes/no. What's the best way of storing that in MongoDB/Mongoid?
[14:54:40] <ichilton> In SQL, i'd obviously use a separate link table, in effect doing a many-to-many with itself.... but what's the right way to do that in MongoDB?
[14:58:10] <wereHamster> array of group ids and the additional data
[14:59:12] <wereHamster> group is { name: 'The Group', affiliatedGroups: [ { _id: X, accepted: true, affiliatedAt: Date }, ... ] }
[14:59:50] <ichilton> ah, so an array of hashes effectively?
[15:02:27] <NodeX> it normaly depends on your access patterns
[15:17:45] <jeremy-> Hello, on the node we were discussing before, I found out where my issue was after you guys gave me the advice, i created a pastie to try and explain my problem
[15:17:48] <jeremy-> http://pastie.org/5642991
[15:18:23] <jeremy-> Basically, I want to programmatically design some conditions for mongo that may or may not exist using php
[15:18:56] <jeremy-> If i write the statement and create a php associative array for each mongo statement, i can give each statement a curly bracket, but if i try and stack all my conditions in one array, they all share a curly bracket so it doesnt work
[15:19:19] <jeremy-> note*
[15:21:30] <sanderj_> Can anyone recommend where I can get my php/mongodb application hosted as a platform?
[15:21:41] <jeremy-> I forgot to add to the pastie how i am getting my test case that doesnt work, obviously: array( '$or' => array( $or_array ));
[15:21:51] <NodeX> sander__ : heroku ... but it;s not cheap
[15:22:26] <NodeX> jeremy.... the best way I try to attack nesting problems is make it work in Json then reverse it in php
[15:22:43] <NodeX> json_decode back to a php array is easy to read
[15:23:06] <jeremy-> Well thats how i was getting the examples i made for the pastie
[15:23:25] <jeremy-> To put it simply because its kind of expecting you to read a wall of text...
[15:23:52] <NodeX> dont merge your arrays, give me a minute and i'll write you one
[15:24:07] <jeremy-> Oh, that might be it
[15:24:19] <jeremy-> Its just i wanted to merge the subsequent array, $searchTerms
[15:24:28] <jeremy-> I figured it would retain child nesting but only merge the parent
[15:25:10] <jeremy-> The top statement works no problem
[15:25:36] <jeremy-> Just the bottom one, where i build the statement programatically, array( '$or' => array( $or_array )); the json_encode output turns out like the last line
[15:25:59] <jeremy-> which has all the {key1, val, key2, val, key3, val}
[15:26:11] <jeremy-> instead of {key, val}, {key, val}, {key, val}
[15:26:43] <jeremy-> so much harder to write mongo queries in php than python :D
[15:29:26] <jeremy-> Succinctly, I want print_r(json_encode($associative_array)) to put a curly bracket around each key/value, instead of only one curly bracket around the entire thing
[15:29:52] <jeremy-> so that it is valid for a mongodb $or statement
[15:30:01] <jeremy-> finally asked it in a way that isnt stupid :D
[15:30:09] <hersha> All of the sudden one of the databases on my shard cluster started throwing a "setShardVersion failed" on one of my nodes. This database has been running fine for 4 months with no problems. Any ideas?
[15:30:45] <jeremy-> i might be able to ask that question in php now that it is succinct
[15:30:57] <NodeX> http://pastie.org/5643051
[15:30:59] <NodeX> try that
[15:32:35] <jeremy-> NodeX, if you look at my original paste, see how the one you created does the same thing
[15:32:42] <jeremy-> Each statement is inside one curly bracket
[15:32:52] <jeremy-> so thats, { abc, def, ghi }
[15:33:06] <jeremy-> instead of {abc}, {def}, {ghi} (missing the rest of course
[15:33:13] <jeremy-> because the $or wants each in its own curly brackets
[15:33:25] <hersha> Here is the error thats getting returned error: {
[15:33:26] <hersha> "$err" : "setShardVersion failed host: 10.11.12.86:27017 { oldVersion: Timestamp 0|0, oldVersionEpoch: ObjectId('000000000000000000000000'), ns: \"tekno_records.tekno_records\", version: Timestamp 1060000|21, versionEpoch: ObjectId('5064a757e45bc0a1544406b9'), globalVersion: Timestamp 1061000|1, globalVersionEpoch: ObjectId('5064a757e45bc0a1544406b9'), reloadConfig: true, errmsg: \"shard global version for collection is higher than trying to set to
[15:33:27] <hersha> 'tekno_records.tekno_records'\", ok: 0.0 }",
[15:33:28] <hersha> "code" : 10429
[15:33:29] <hersha> }
[15:33:59] <jeremy-> so the way that i know thats each to make each statement in its own curly bracket is to have each as an array
[15:34:04] <jeremy-> easy*
[15:34:25] <jeremy-> so you can write it like my original code, but then I dont know how to make it dynamic (conditionally not have one of the elements)
[15:34:39] <kchodorow_> hersha: try running db.adminCommand({flushRouterConfig:1}) on the mongos giving you errors (or restart it)
[15:34:56] <jeremy-> I'm probably busting your chops and im sorry to drain you as a newbie
[15:35:16] <hersha> kchodorow_: tried both of those
[15:36:42] <NodeX> it's fine jeremy- ... $or's can be confusing, give me a few mins, it's crazy busy here
[15:36:58] <jeremy-> fair enough thanks
[15:37:18] <jeremy-> now that i have actually written down the problem i think i may eventually get there myself too
[15:37:56] <jeremy-> Oh, you know how you could do it, create a for loop, and write every value of that array into a new array
[15:38:04] <jeremy-> then print the new array and presto the additional curly
[15:38:11] <BadCodSmell> I just did this to cram my db: http://pastebin.com/EX6ftESr I understand how you can get slack space when things aren't packed and mongo doesn't unallocate after removal, but this is pretty huge (6x), is there any documentation coverring specifically this kind of issue and minimising bloat?
[15:39:21] <timah> badcodesmell: i think i'm having a similar issue.
[15:39:46] <timah> i've asked my question a few times. however, seemingly at just the wrong time each time.
[15:40:04] <BadCodSmell> The reason I find this bloat weird is because all I rarely update and mostly mongo restore every now and again to it (poor man's replication), it's read only otherwise.
[15:41:57] <timah> here's my document: { _id: { m: <int>, o: <objectid> }, a: <int>, b: <int>, c: <int>, d: <int>, e: <int> }
[15:42:37] <timah> aside from the size of the various ids, the size of the document does not fluctuate, at all.
[15:42:58] <timah> and is used in an insert-only/read collection.
[15:43:20] <timah> however… it seems that my minimum document size is always 16MB… no matter how small i make it.
[15:44:57] <timah> any advice? anyone? even a point in the right direction?
[15:45:41] <NodeX> {"$or":[{"abc":{"$in":[1,2,3]}},{"def":{"$in":[4,5,6]}},{"ghi":{"$in":[7,8,9]}}]}
[15:45:42] <NodeX> :D
[15:45:45] <timah> all of my seemingly endless research has only led me to posts/docs concerning increasing the minimum document size from 16MB.
[15:46:21] <NodeX> jeremy- : http://pastie.org/5643114
[15:46:22] <NodeX> ;)
[15:47:16] <NodeX> you might want to initialise $a & $b too
[15:49:03] <timah> i don't know what my /actual/ document sizes are… but i can bet they are much smaller than 16MB.
[15:51:02] <hersha> timah: pass your document to Object.bsonsize() to see the actual size of the document.
[15:51:15] <jeremy-> YES
[15:51:17] <jeremy-> VICTORY
[15:51:40] <jeremy-> Nodex definately my hero thankyou very much mate
[15:52:29] <NodeX> you can do the same with arrays if you need to
[15:53:26] <jeremy-> I'm seeing advantages of your OO approach anyway, though
[15:53:43] <NodeX> it's a bit cleaner like that
[16:00:11] <hersha> le sigh
[16:02:37] <sanderj_> NodeX, So is there some alternatives with mongodb hosting?
[16:03:21] <NodeX> sander__ : I am sure there are but I have not heard of them
[16:05:30] <hersha> Any other ideas on my setShardVersion failed issue? About ready to rebuild the collection.
[16:06:28] <sanderj_> NodeX, when it says replication.. Does it mean sharding/spreading of data around? That's atleast what I want.
[16:07:00] <hersha> replication isn't sharding
[16:07:15] <hersha> it means a replica set for data integrity
[16:08:11] <sanderj_> hersha, so basicly most mongodb hosting is useless if you want to scale writing with over 1 server?
[16:08:26] <hersha> oh wth restarted the node that was causing the error and it fixed it >,<
[16:08:46] <NodeX> sander__ : I dont have a clue, I dont use them and never would because they're far to expensive
[16:09:21] <sanderj_> NodeX, Ok ok. Guess I wont eather.
[16:09:48] <NodeX> some people in here do use them so I assume they must be doing somehting right
[17:18:44] <w0rmdr1nk> 10gen should have better funding model for features
[17:18:52] <w0rmdr1nk> which allows people to pay for features they want
[17:18:58] <w0rmdr1nk> or something
[17:19:17] <w0rmdr1nk> either way, when will we see better mechanism on config servers for sharding
[17:19:44] <w0rmdr1nk> something closer to a normal replica set rather than the three phase commit
[17:20:10] <w0rmdr1nk> cos I dont like the limitation of 3 config servers, especially if there is one production and one disaster recovery data center
[17:20:50] <Derick> w0rmdr1nk: I'm pretty sure that if you mail sales@ they'd talk to you
[17:21:37] <w0rmdr1nk> and in general I would prefer a config server on each node - especially with large clusters, otherwise there is more sensitivity on downtime for specific nodes.
[17:21:41] <w0rmdr1nk> maybe
[17:34:54] <drunkgoat> what would you say a better approach for a chat server with mongo: capped collection with tailable cursor or an indexed capped collection using a regular cursor?
[18:10:00] <timah> is it more performant to ensure a consistent document width within a collection vs. keys with null values?
[20:03:24] <Virunga> With the node.js mongodb driver, if one wants to perform an insert/update must retrieve the collection first and then make the operation. Does really retrieve the whole collection? Is there a more efficient way to do this?
[23:25:26] <bencc> is the source of http://try.mongodb.org available somewhere?
[23:26:46] <bencc> https://github.com/banker/mongulator