PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Friday the 11th of July, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[01:17:41] <danfinch> is it true that mongorestore with --collection and --drop will only drop the collection specified in the command line?
[01:23:44] <danfinch> and if I do not provide collection, does it only drop those which already exist at the destination?
[01:24:11] <cheeser> you'll want to test that one...
[01:24:29] <cheeser> import into a new db. create a new collection or two, then import with --drop and see
[01:28:40] <danfinch> will do, would like to see if someone who knows they know knows, too, since I can't find anything that clear in docs/basic googling
[03:34:02] <QS> any idea what's the best way to get running number of id?
[03:34:50] <blkcat> running number?
[03:35:09] <QS> i mean like auto increment
[03:35:34] <cheeser> http://docs.mongodb.org/manual/tutorial/create-an-auto-incrementing-field/
[03:35:53] <QS> thanks!!!
[06:53:59] <samurai2> hi there, anyone know how to access field with space with dot notation in mongodb terminal? thanks
[06:54:37] <samurai2> so for example there is mongodb document looks like this { "first name" : "alpha"}
[06:54:50] <samurai2> then I assign this document to var a
[06:55:08] <samurai2> how to access that "first name" value using dot notation? thanks
[06:57:57] <QS> a['first name'] ?
[06:58:19] <QS> i dont think javascript can do it in dot, im not too sure
[06:58:55] <QS> i meant for space
[07:04:39] <joannac> What QS said
[07:09:36] <shambat> I have a python script that loads in two large json files, this is causing my VPS to crash since all the memory is being used up. I would like to store these files in a database like mongodb instead. Is there a way to get mongodb to use disk instead of memory, or set a maximum or something? I am not as concerned with speed.
[08:35:57] <sweb> is it possible save same id on different collection ?
[08:36:37] <sweb> i have mirror collection ... latest_news and archive_news i want have all latest news on archive_news
[08:37:03] <sweb> for tiny collection on complex type of fetch and archive for regular fetch
[08:41:06] <rspijker> sweb: _id’s don;t have to be unique over collections
[08:41:49] <sweb> rspijker: is unique over one collection, so i can :)
[08:43:22] <rspijker> inside of a single collection it needs to be unique, yes. But if you have two documents, say a and b from collections A and B respectively. Then there is no objection to a._id == b._id
[09:45:04] <user123321> If I could open a mongo-db using robotmongo which has been hosted remotely, how to get that database up and running in my Ubuntu/LUbuntu host?
[10:13:54] <rspijker> user123321: what?
[10:31:06] <user123321> rspijker, how to get a copy of the mongo-db database which is hosted in mongolab.com? I can access it using robomongo. I'd like to host in my machine itself.
[10:33:25] <rspijker> user123321: http://docs.mongodb.org/manual/reference/command/copydb/
[10:40:59] <user123321> rspijker, thanks.
[10:54:04] <kas84> Hi
[10:54:23] <user123321> hi
[10:54:47] <kas84> I’ve just installed mongo-10gen-server on my aws machine but don’t see the “mongo” command
[10:54:55] <kas84> the client, not mongod
[10:55:07] <kas84> I’ve set up mongod without any problem
[10:56:04] <joannac> redhat?
[10:56:35] <joannac> my suspicion is you didn't install the package with all the tools
[10:56:38] <joannac> http://docs.mongodb.org/v2.2/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/#packages
[10:57:01] <kas84> yep
[10:57:05] <kas84> you’re right
[10:57:09] <Derick> "10gen-server" is just the server
[10:57:12] <kas84> I was lacking mongo-10gen
[10:57:19] <kas84> thanks, mate!
[12:16:48] <similian> should i be using mongo or mysql for the evaluation of apache access logs ( page visitors, pageview, referrer by unique visitor, aggregate unique visitors ... )
[12:18:01] <similian> ~ couple of 100 Gigs per month
[12:18:55] <similian> per anno sry
[12:19:22] <similian> so a bit above average ... but not super big
[12:28:11] <lfamorim> Hello! Someone knows why this query took so long to run on Mongo 2.6? http://pastebin.com/1CdWtHQF
[12:37:20] <adamcom> "nYields" : 8359,
[12:37:37] <adamcom> the most common reason for a yield is that it's hitting disk
[12:37:56] <adamcom> which means the index/data was not in memory
[13:47:23] <_rgn> if I embed "user" document originally in users coll, to another document, what should the id field be called in the subdocument?
[13:47:55] <_rgn> { foo: 'bar', user: { name: 'Bob', <id?> }
[13:49:03] <_rgn> to clarify, i mean the field that has the ObjectId reference to users collection
[13:59:42] <Breaking_Pitt> Hi guys... I have mongo 2.4.10 and I'm getting this error running db.stats();
[13:59:44] <Breaking_Pitt> { "ok" : 0, "errmsg" : "missing ns: -fʵ��#�C�+���_\"j2�t7���" }
[14:00:03] <Breaking_Pitt> Some advice on what's going on?
[14:02:22] <oceanx> hi, I wrote an aggregation pipeline, and the last step is a projection, I want to return only the content of one of the fields (which is a dictionary) is there a way to do so without having to return the full document or projecting every single field of the sub-document?
[14:02:25] <oceanx> thanks :)
[14:02:38] <oceanx> cannot sort this out by myself :)
[14:07:37] <cheeser> i'm not sure i know the answer but it'd help if you pastebinned somewhere what you tried and what you got back.
[14:14:07] <nacer> hello guys
[14:14:47] <nacer> what do you thin about a shard with member with different memory size ? like node1 -> 64Go , node2 -> 64Go, node3 -> 16Go
[14:15:25] <nacer> in this case i will have a config that will prevent the node3 to become MASTER
[14:17:13] <adamcom> you can just set it to priority 0 to make sure it never becomes primary - I'd consider making it a hidden node also, that way you don't hit it for queries to the replica set (but you could send it queries directly)
[14:17:31] <Derick> hi hi adamcom
[14:17:37] <Derick> > db.foo.aggregate( [ { $project: { _id: 0, amsterdam: { $hour: [ ISODate("2014-07-10T14:05:15"), "Europe/Amsterdam" ] }, tokyo: { $hour: [ ISODate("2014-07-10T14:05:15"), "Asia/Tokyo" ] } } } ] );
[14:17:41] <Derick> { "amsterdam" : NumberLong(16), "tokyo" : NumberLong(23) }
[14:17:46] <Derick> whoop!
[14:18:03] <nacer> adamcom: that's the plan
[14:19:01] <adamcom> nacer: if you keep traffic away from it that might hurt it with the lesser RAM, and have it at priority 0, then you should be fine
[14:19:08] <nacer> adamcom: i want to know if someone is going to says "WARNING BAD IDEA" because ...
[14:19:36] <Derick> nacer: what
[14:19:41] <adamcom> nacer: as long as you know the implications - the real danger is that a lesser spec machine can't keep up
[14:19:45] <Derick> nacer: what's the reason for having node 3 only 16Gb?
[14:19:53] <nacer> Derick: money
[14:20:00] <Derick> good enough reason :D
[14:20:05] <nacer> :)
[14:28:52] <oceanx> @cheeser sorry but I can't paste right now cause there's an NDA on data, but I solved just denormalizing data
[14:29:17] <oceanx> and doing a projection of a few fields I needed, thanks! :)
[14:31:02] <cheeser> fair enough
[15:14:16] <San1ty> Hi Guys, I´m stuck with a rather annoying issue that I can fix. I have two processes connecting to the same mongodb database but writing to two separate collectiosn. the process write to their respective collection every 10 seconds.
[15:14:28] <San1ty> Now at sporadic moments both my process exit at the same time with the following error
[15:14:29] <San1ty> MongoError: E11000 duplicate key error index: mydb.mycoll.$_id_ dup key: { : ObjectId('53b8b6c8292b875b0a31914f') }
[15:18:18] <rspijker> San1ty: seems fairly self-explanatory to me?
[15:18:40] <San1ty> rspijker, yeah I get what it means but I dont understand why
[15:18:51] <San1ty> how can I get a dup key error? I always insert new records
[15:19:23] <San1ty> and itś entirely possible the process runs fine for 5 days and then suddenly it´ll error out it´s very sporadic
[15:19:41] <rspijker> and both always ‘error out’ at the same time?
[15:19:52] <San1ty> exactly
[15:19:59] <San1ty> with the same error but with a different objectId
[15:20:07] <rspijker> what does your insert look like?
[15:20:23] <San1ty> it´s written in node.js just a sec
[15:21:30] <_rgn> if I embed "user" document originally in users coll, to another document, what is the ObjectId typically called in the subdocument, simply _id?
[15:22:38] <rspijker> _rgn: unless you have a good reason to call it something else, that shouldn;t be a problem
[15:24:19] <San1ty> rspijker, I´doing a bulk insert of a couple of entries collection.insert(entries, function(err) {
[15:24:42] <rspijker> what do your entries look like?
[15:26:13] <San1ty> rspijker I let the ID be autogenerated and the rest are just a bunch of numbers with one field being a timestamp
[15:26:51] <San1ty> rspijker, i´m using mongojs as a rapper for the mongoDB API https://github.com/mafintosh/mongojs
[15:26:54] <rspijker> San1ty: hmmm, that’s weird…
[15:27:23] <San1ty> rspijker, very, I really have no clue what it might be
[15:27:38] <San1ty> rspijker, is there some kind of rule against inserting at the exact same time to two different collections
[15:27:50] <rspijker> none whatsoever
[15:28:34] <rspijker> maybe the node driver doesn’t handle it correctly or something...
[15:28:57] <San1ty> just doublechecked both process error out on the EXACT same second
[15:32:52] <rspijker> well… you could generate an ObjectId in the driver instead of having mongod do it
[15:33:12] <rspijker> apparently this guy had a similar issue: http://stackoverflow.com/questions/16133602/during-insert-e11000-duplicate-key-error-index
[15:33:32] <rspijker> I’d say, try that. Not sure why it would happen in the first place though...
[15:34:04] <San1ty> rspijker, good suggestion
[15:34:29] <San1ty> rspijker, .BSONPure.ObjectID(); does the trick then?
[15:34:47] <rspijker> think it should
[15:35:02] <rspijker> but I’m not familiar with the node driver, so only going off of that SO question
[15:36:16] <San1ty> rspijker, I do delete some records first tho
[15:36:33] <rspijker> shouldn’t really matter
[15:36:56] <San1ty> yeah that´s what I think as well
[15:37:55] <rspijker> Only thing I could think of is that mongo thinks the just deleted _ids are now available again, but they’re still in the index or something… Moving the id creation to the driver should sort that. But it’s a stretch anyway
[15:42:13] <user55> Hello! I would like to ask a question, about finding and matching embedded arrays, array items.
[15:42:16] <user55> We need to represent a tree structure in mongo.
[15:42:23] <user55> http://docs.mongodb.org/manual/tutorial/model-tree-structures-with-ancestors-array/
[15:42:26] <user55> This solution would be the best for us, our client-side applications works with the same approach.
[15:42:33] <user55> A document may look like this: {path:['path', 'to', 'resource', 'one'], resource: 'I am a Resource!'}
[15:42:37] <user55> We want to achieve something like BASH glob-s, for example:
[15:43:33] <user55> path/to/resource/one: matches a single resource, this is the most important for us
[15:43:40] <user55> path/to/* : match all resource starting with path, also important
[15:43:44] <San1ty> rspijker, might the reason be that I insert in the callback of the delete query?
[15:43:56] <user55> */to/resource/* : match a fragment of the part, not so important
[15:44:03] <user55> */resource/one : match the end of the path, not so important
[15:44:07] <user55> Is there an efficient way to do this kind of thing?
[15:44:10] <user55> Should we select another solution without embedded arrays?
[15:44:15] <user55> In the 'important' cases efficiency is also important.
[15:44:19] <user55> In the 'not so important' cases, any solution will do.
[15:44:24] <user55> Any help is welcome!
[15:44:32] <user55> (and sorry for the interruption)
[15:44:34] <rspijker> San1ty: it could be… but then that would be driver specific, I think… again, no clue on how node driver works :(
[15:45:06] <San1ty> rspijker, one more thing do _id´s need to be unique across collections
[15:45:12] <rspijker> no
[15:45:17] <rspijker> only inside of a collection
[15:45:38] <rspijker> user55: the only real problem I see is ordering…
[15:45:44] <rspijker> your paths are ordered, arrays are not
[15:47:11] <user55> rspijker: can you suggest a different kind of solution?
[15:47:13] <rspijker> easiest solution to that I can think of is making your ancestor array an array of documents instead of strings. Where each document has the name of the ancestor and the level
[15:48:46] <rspijker> your example: {path:[{n: path, l:5},{n:to, l:4},{n:resource, l:3},{n:one, l:2}], resource: “I am a resource”}
[15:48:52] <rspijker> add quotes where needed
[15:49:10] <rspijker> in this case I made the levels relative to the resource, that might not be the best option
[15:49:56] <kali> it might be enough to store the position (l) only once, as the position in the immediate parent
[15:50:33] <rspijker> I’m assuming you;ve also considered this model: http://docs.mongodb.org/manual/tutorial/model-tree-structures-with-materialized-paths/
[15:50:46] <kali> so you store the path array (provide breadcrumbs and subtree search) and the position in the parent in each doc
[15:51:49] <user55> rspijker: of course, that was the basic source of the idea
[15:51:51] <rspijker> the path array approach does impose some limitations… you can’t have the same resource name in different locations without breaking things
[15:53:43] <user55> what about this: {path:[{1:path},{2:to},{3:resource}], resource: “I am a resource”}; is this valid?
[15:54:05] <lfamorim> adamcom, how I put the index on memory?
[15:54:35] <rspijker> user55: it’s valid… not sure if it’s the best…
[15:54:43] <rspijker> you can’t easily query on field names
[15:56:21] <rspijker> user55: so, what was the reason for not choosing that materialized path approach?
[15:57:37] <rspijker> the two queries you find important can be optimized with an index. And the ones you find less important can be supported as well (though not as fast)
[15:59:13] <rspijker> guess his internet died…
[15:59:24] <rspijker> well, I’m off
[15:59:27] <rspijker> o/
[16:05:48] <lfamorim> Hello! Someone knows why this query took so long to run on Mongo 2.6? http://pastebin.com/1CdWtHQF https://stackoverflow.com/questions/24697892/slow-indexed-query-whats-wrong?noredirect=1#comment38300178_24697892
[16:11:39] <saml> why is it slow?
[16:11:41] <saml> seems fast
[16:12:09] <saml> "n" : 45653, "nscannedObjects" : 45653, means fast right?
[16:48:16] <oceanx> is there a way I can make an $unwind in aggregate on a subdictionary?
[16:53:23] <oceanx> http://pastebin.com/58wu3ZrE
[16:53:31] <oceanx> this is how my document looks like
[16:53:57] <oceanx> I need to get only the "levels" which are enabled
[17:58:39] <lfamorim> Someone know why this query took this long to run? http://pastebin.com/h8auApjS 1,287 sec
[18:02:08] <zhodge> I have a db of logs and right now a redundantly named collection called logs which stores log documents that all have a `type` property distinguishing certain logs from others
[18:02:20] <zhodge> would it make more sense to simply have those distinct type values as collections?
[18:06:20] <jchamberlain> hey all
[18:07:11] <jchamberlain> I've got a question if anybody's not too busy
[18:08:53] <cozby> how does one purge all user info? Even after deleting all the data in my /data dir
[18:09:03] <cozby> I'm still unable to login and run commands against admin
[18:09:42] <cozby> oh I also deleted everything in /journal
[18:10:23] <jchamberlain> if you've deleted everything but auth is still required, wouldn't that be expected? (mongo noob here)
[18:10:51] <cozby> well yeah, auth is required, but if you launch a fresh mongo instance with auth connecting without auth works fine
[18:11:12] <cozby> I guess I could remove auth
[18:21:19] <jchamberlain> in PHP, is it possible to return a query result as a json string instead of an array?
[18:29:09] <QS> i tot u could always do a json_encode?
[18:36:57] <sebastian_o|> hi guys, what you consider good API design when your API needs to answer a create when the object already exists? bad request? server error? or a 200 with a false in payload?
[18:53:09] <cozby> clear
[18:57:05] <lpin> sebastian_o| 409 ?
[18:58:12] <sebastian_o|> mm possibly a good idea
[18:58:51] <lpin> http://httpstatus.es/409
[19:00:28] <sebastian_o|> yes, will probably do
[19:02:16] <lpin> you could take a look at what popular APIs return for conflicting resources like github, twitter etc.
[19:03:13] <sebastian_o|> good point! github returns 409, they say
[19:03:40] <sebastian_o|> "Git DB API functions will return a 409 Conflict if the git repository for a Repository is empty or unavailable. This typically means it is being created still. Contact Support if this response status persists."
[19:04:30] <sebastian_o|> https://developer.github.com/v3/#client-errors
[19:07:28] <lpin> i think that also pouchdb uses 409
[19:08:48] <sebastian_o|> right
[19:22:14] <lpin> sebastian_o|, from your link it seems that github return 422 with a "validation failed" message and a "already_exists" code
[19:24:17] <cozby> exit
[19:24:20] <cozby> er sorry
[19:41:27] <luis_alen> Can a single mongo instance act as arbiter for different clusters/replica sets?
[19:46:50] <cheeser> no
[19:47:26] <luis_alen> thanks
[19:47:52] <tscanausa> luis_alen: you could run mulitple instances on a single server
[19:48:22] <luis_alen> tscanausa: yeah, I think that's what I'm going to do.
[21:44:20] <styles_> Can I use aggregate to count all the words in all sentences in a collection?
[21:44:32] <styles_> I am doing it with map reduce right now, but I'd like to try the aggregate framework if possible
[23:38:57] <travisgriggs> i have a test/prototype mongodb on a 32 bit linux install. i have a new 64 bit linux machine running mongo now… is there an easy way to copy the data from the one to the other. i’m getting createPrivateMap errors on the 32 bit machine, so it seemed time to remove the 32bit as a potential problem
[23:40:02] <travisgriggs> i assume it’s not as simple as copy the /var/lib/mongodb directory (that would be the cat’s meow if it WAS that easy…)
[23:55:00] <travisgriggs> ok, i found mongodump, but i can’t even get it to run. i get the open/create failed to createPrivateMap error. anyone know how i can diagnose/fix that error?