PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Friday the 17th of January, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:01:50] <swak> so say if I'm trying to delete a document but I'm not sure of it's content but I know that it's name is something specific
[00:02:02] <swak> like: "Name": "Something random"
[00:02:37] <swak> How do I target it by the key "Name" instead of by doing a search for the values.
[00:25:40] <pasichnyk> Ok, might have some more info. Looks like when the cpu really spikes, is when a large (in this case 192k) update comes in, that increments a ton of values in a single document. That use case should be supported fine right?
[00:42:48] <swak> Is there life here?
[00:44:02] <jkitchen> not really
[00:44:10] <swak> lol
[00:44:14] <jkitchen> some stray bits floating about
[00:44:37] <swak> Any idea how to delete an entry based upon a key instead of the value?
[00:47:25] <pasichnyk> ok, does this spark any ideas? I see this right about when my mongod goes to 100% cpu for 10 seconds or so:
[00:47:29] <pasichnyk> Thu Jan 16 16:34:48.682 [conn149] serverStatus was very slow: { after basic: 0, after asserts: 0, after backgroundFlushing: 0, after connections: 0, after cursors: 0, after dur: 0, after extra_info: 0, after globalLock: 0, after indexCounters: 0, after locks: 0, after network: 0, after opcounters: 0, after opcountersRepl: 0, after recordStats: 8929, after repl: 8929, at end: 8929 }
[00:47:29] <pasichnyk> Thu Jan 16 16:34:48.682 [conn149] command admin.$cmd command: { serverStatus: 1 } ntoreturn:1 keyUpdates:0 locks(micros) r:34 reslen:3972 8990ms
[00:47:48] <pasichnyk> took 9s to get server stats, seems odd right?
[01:05:22] <pasichnyk> Ok, this might be something. When the server peaks out at 100% cpu for up to 30s at a time, the only active command showing in the db.currentOp() is showStats, and here its taking over 19s. Is that a symptom of something or the cause? http://pastebin.com/gUNMRdYu
[01:13:13] <DrStein> In this guid: http://docs.mongodb.org/manual/tutorial/migrate-config-servers-with-different-hostnames/ it says I should shutdown all the config servers, but it doesn't say when should I restart them. I presume I should do that after restarting the shards. Am I right?
[01:13:18] <DrStein> guide*
[01:46:04] <radioact1ve> quick question, cant seem to find solid docs on google. How well supported is C# driver on mono?
[01:46:19] <radioact1ve> tied to a particular version of mono?
[01:50:36] <patricioe> :cheeser you around? Any idea what's up with Morphia 0.106-SNAPSHOT (and also .105) and the @references? They seem broken when querying a document that contains a DBRef.
[01:51:13] <patricioe> cheeser: ^
[02:17:55] <cheeser> patricioe: they're not broken as far as the unit tests show.
[02:21:19] <patricioe> I see. Our tests failed after upgrading.
[02:21:36] <patricioe> cheeser: see my last comment http://stackoverflow.com/questions/19841494/morphia-serialization-error-when-updating-object-with-list-of-references
[02:22:45] <cheeser> did you save the @Referenced objects first?
[02:23:06] <patricioe> yup.
[02:23:15] <patricioe> in fact the test used to pass just fine.
[02:23:26] <patricioe> and the DB contains both objects.
[02:23:42] <cheeser> i'll need a full test case to reproduce that.
[02:24:34] <patricioe> ok. Will try to come up with one.
[02:51:27] <patricioe> cheeser: mind taking at look this? http://pastebin.com/2mAfmF9s
[02:52:11] <patricioe> line 66 is the broken one.
[03:04:53] <cheeser> patricioe: i'll check it in the morning when I get back in to the office.
[03:05:03] <cheeser> not *quite* set up here just now.
[03:05:32] <patricioe> thank you. I figure you just moved? :)
[03:06:47] <cheeser> nah. home for the evening. this laptop isn't quite set up to run morphia tests.
[03:38:22] <mrpoundsign> quick Q. I have a collection of a bunch of {x: int, y: int, color string, updated timestamp} and I want to be able to say "show me all the distinct <x> and <y> before <timestamp> ordered by <timestamp: -1>" -- is this possible? I want to show a representation of a pixel canvas at a given snapshot. I am logging all actions, but some may be very old.
[05:48:46] <b_oneal> Hey anyone know of a way to find a mongos server from a config server?
[05:49:11] <b_oneal> As in who all is running mongos and connected to the cluster
[05:50:17] <b_oneal> I also want to know given one config server who the other two are - but if I had a mongos server I would have that information.
[06:20:47] <lkthomas> hey guys, something I don't understand with MDB, if all object is based on hashkey and data, how should I store hashkey at the first place ? does it means I have to use another DB to store the hash ?
[06:22:31] <trupheenix> can anyone here help me with searching text in an array? I have multiple regexes and I want all of them to match in the array in order for a result to be accepted.
[06:24:41] <ron> lkthomas: what?
[06:24:50] <lkthomas> nevermind
[06:45:17] <jeanre> ok mongoose or ?
[07:42:45] <yujin> hi guys, i was using db.collection.findAndModify, but it kept giving me an error of "exception: must specify remove or update", but i have specify, query and update
[07:42:54] <yujin> do anyone encounter this before?
[07:49:50] <trupheenix> anyone here who knows how to use $elemmatch with pymongo?
[07:52:35] <megawolt> @yujin could you send your query with pastie.org?
[08:00:32] <trupheenix> megawolt, can you help me with a pymongo query?
[08:00:43] <trupheenix> megawolt, I am confused on how to use elemMatch in pymongo
[08:00:53] <megawolt> sorry trup i'm developing with c#
[08:01:54] <trupheenix> megawolt, ok
[08:02:08] <trupheenix> anyone here who can help me with pymongo queries?
[08:02:13] <trupheenix> I'm trying to use elemMatch
[08:04:38] <megawolt> pymongo looks similar to mongodb simple query
[08:04:48] <megawolt> where were you stacked?
[08:06:05] <trupheenix> megawolt, I cannot figure out where does my elemMatch go.
[08:06:56] <megawolt> could you send a sample with pastie.org
[08:07:09] <trupheenix> megawolt, ok
[08:07:22] <megawolt> we could easily discuss with code
[08:08:11] <trupheenix> megawolt, ok looks like i got my answer
[08:09:27] <megawolt> great :)
[11:28:13] <strangewildthing> How do I use mongo (probably the aggregation framework) to select a query which groups together distinct fields?
[11:31:48] <strangewildthing> Something like this? http://jsfiddle.net/XNm78/
[11:32:31] <strangewildthing> it seems to work, but i created the query randomly... can anyone explain why we assign an object containing the fields we want to "_id"
[11:32:40] <jeanre> anyone here use mongoose, and particularly mongoose-tree2?
[11:32:55] <jeanre> http://pastie.org/private/nogwfrxslxcmjzlvjirkkg
[11:33:00] <jeanre> its completely discarding the deleted:false, as it returns objects with deleted:true
[11:33:01] <strangewildthing> and what does "$field1" mean in the line "{field1: "$field1", field2:"$field2"}"
[13:24:53] <Lobosque> I want to store in mongodb all cities for each state. How do you guys recommend doing this? I was thinking of {state: 'XX', cities: Array('City1', 'City2',...)}
[13:25:37] <megawolt> that depends how do you want to use them
[13:25:56] <megawolt> but i suggest subdocument more than array
[13:26:33] <Lobosque> megawolt, this will be read only, just so I can fill a form via ajax once you select your state
[13:27:07] <Lobosque> megawolt how would that be? Sorry I'm new to mongo and still wrapping my head around it
[13:31:05] <megawolt> like that
[13:31:05] <megawolt> http://pastie.org/8642267
[13:36:39] <Lobosque> megawolt I see... why do you recommend that?
[13:37:18] <Lobosque> also, what about one entry (document) for each city?
[13:37:33] <megawolt> in case of you want to use
[13:37:37] <megawolt> array can be faster
[13:38:13] <megawolt> but in further of system you want to report or relational queries
[13:39:08] <megawolt> arrays are real bad querys performance
[15:20:07] <ShortWave> Hi all
[15:20:46] <ShortWave> Anyone here use Node.js with mongo? I'm lost on this ObjectId() business, I keep getting duplicate records even tho I'm setting the target ID to _id : ObjectId(someId);
[15:23:45] <cheeser> so you're creating an ObjectId with a seed value and wondering why you get duplicate IDs?
[17:10:53] <patricioe> cheeser: you around?
[17:11:22] <ron> try asking your question, maybe others can help too.
[17:11:26] <ron> yes, even if it is about morphia.
[17:11:31] <patricioe> I found the bug last night. It was a commit made in july
[17:11:32] <ron> or the java driver.
[17:11:53] <patricioe> Also got a patch.will send a PR then.
[17:14:37] <bbfrefv> i'm unable to authenticate with my database. seems like the users are deleted for some reason. also i get, "TypeError: db.adduser is not a function (shell):1" when trying to add a user. why?
[17:36:39] <ruphos> make sure the database you're connecting to is the one where your users have permission
[17:37:17] <ruphos> if your users have privs to db_one but you're connecting to db_two and attempting to auth, it will fail
[17:38:28] <ruphos> db.adduser is failing because the command is db.addUser
[17:44:59] <Iuur> Hej what is the proper way in c# to use implent some kind of multi thread forward iteration? (So I have multiple threads which should get the next item in the collection -> if the end is reached it should go to the first one)
[17:49:15] <b_oneal> Hey anyone know of a way to find a mongos server from a config server? As in who all is running mongos and connected to the cluster.
[17:51:16] <Joeskyyy> b_oneal: Should be in the config database
[17:51:20] <Joeskyyy> config.mongos I believe.
[17:51:30] <Joeskyyy> each _id is the address of a mongos
[17:52:34] <b_oneal> So obvious! Thanks
[17:52:38] <Joeskyyy> Anytime (:
[17:56:08] <b_oneal> Hmm Seems not to work well with port forwarding or multiple mongos's bound to a box since it pulls the hostname and port from the connection not the registered bind address from mongos... But for most situations I think I can work with this. Any way to force registration of the bind address? This feature is available for connections in databases like MySQL, but not often used.
[17:57:09] <b_oneal> (Building a dev test cluster with 20 servers each with 60 instances and thus building a lot of auto discovery automation)
[18:06:35] <bbfrefv> ruphos: ah thanks. capital U made the difference. apparently the users had been deleted though. i had to add them again. how could that have happened? i never deleted them and no one else has access to the server
[18:15:06] <remote> can I ensure uniqueness of an id field only if another field is set to a specific value?
[18:19:11] <jiffe> mongodb needs to move to an auth by default model
[18:21:19] <cheeser> it makes dev environments less pleasant, though
[18:21:44] <cheeser> and, ime, what the auth/role set up should look like isn't always clear up front
[18:24:02] <ruphos> bbfrefv: haven't the foggiest what would do that.
[18:25:29] <ruphos> I don't mind the auth set up, but I wouldn't mind if readPref wasn't default set to primary
[18:25:37] <jiffe> I'm guessing there's a lot of insecure setups out there and I've noticed a lot of scanning being done on mongodb ports lately
[18:26:56] <ruphos> if people aren't setting up auth, I doubt they would do much for changing default user / picking a complicated password
[18:27:25] <b_oneal> Auth is not exactly intuitive. Particularly in sharded clusters. I am guessing a lot of people don't use it because they don't understand it.
[18:27:46] <jiffe> Some package managers are getting in the habit of having you setup auth info on install so there is no default
[18:28:05] <jiffe> well maybe that needs to be addressed
[18:28:40] <b_oneal> Other then the local host bypass what default auth is there?
[18:46:03] <aaronds> Hi. New to MongoDB. Just wondering how I can read then update a document, without the possibility of another process reading in between the two? i.e check a field is a certain value before updating it without another process also believing it should update it. If that makes sense...
[18:46:45] <ruphos> findAndModify ensures that, iirc
[18:47:16] <ruphos> http://docs.mongodb.org/manual/reference/command/findAndModify/
[18:49:33] <aaronds> thanks ruphos
[18:55:28] <BlakeRG> we added a replica set to our Mongo instance, on the original machine the size of the DB is 17GB but on the new machine it's only 7.9GB... is there some kind of defragmentation that happens when you replicate a DB?
[18:59:29] <tystr_> I'm trying to do a mongodump, and Im' getting the following error:
[18:59:38] <tystr_> assertion: 10320 BSONElement: bad type 121
[19:02:12] <Joeskyyy> BlakeRG: Not entirely sure on this one, but my mind wants to say it's because your original machine hasn't been compacted in a while.
[19:02:34] <Joeskyyy> So, yeah, kinda like a defrag, but it's only moving the data over to the replica, not the empty space in your original.
[19:02:41] <Joeskyyy> I'd assume at least.
[19:02:45] <BlakeRG> Joeskyyy: yep, thats probably it!
[19:02:52] <BlakeRG> didnt know compact existed
[19:03:24] <Joeskyyy> Yeah, one of the gotchas of MongoDB by default :P
[19:08:21] <tystr_> googling seems to indicate corrupted data, but running the validate comand on the collection that seems to throw this error comes back ok
[19:27:42] <tystr_> hmm upgrading mongo to 2.2.2 fixed the error
[19:27:44] <tystr_> (from 2.2.1
[19:55:26] <bmw0679> Hello, I ran into a really weird situation where I am finding documents with the same _id. I didn't think this was possible. Has anyone seen this happen before?
[20:04:11] <ruphos> I've run into it, but haven't managed to reliably reproduce
[20:09:31] <BlakeRG> is there a way i can see the number of documents i just removed? like "rows affected" in SQL?
[20:09:37] <BlakeRG> i tried .remove().count()
[20:14:52] <Joeskyyy> After you use the remove
[20:14:59] <Joeskyyy> You can run db.getLastErrorObj()
[20:15:05] <Joeskyyy> The "n" field is the number of documents affected.
[20:28:02] <Logicgate> is there a way to use find on a collection with a nested condition?
[20:28:33] <Logicgate> example col.find({field: {subfield: 'value'}})
[20:28:44] <Logicgate> or you have to run a map reduce?
[20:28:59] <ruphos> "field.subfield": value
[20:29:04] <Logicgate> ahhhhh!
[20:29:06] <Logicgate> there is it :D
[20:29:10] <Logicgate> thank you ruphos
[20:29:12] <Logicgate> you da man
[20:29:17] <ruphos> :)
[20:29:35] <ruphos> you just have to actually use the quotes when using the dots on field names
[20:29:45] <ruphos> instead of the lazy quoting you can get away with most of the time
[20:30:53] <Logicgate> sounds good
[20:30:59] <Logicgate> thank you
[20:40:38] <BlakeRG> how do i access/query a collection that has a space or period in the name?
[20:41:52] <Joeskyyy> Period you would do it as normal
[20:42:00] <Joeskyyy> i.e. db.derp.test.find()
[20:42:10] <Joeskyyy> I don't believe you can do a space though
[20:42:59] <Joeskyyy> http://docs.mongodb.org/manual/reference/limits/#Restriction%20on%20Collection%20Names
[20:44:32] <Joeskyyy> Doesn't indicate you can't use a space char however :\
[20:44:56] <Joeskyyy> It is included on the database names however
[20:45:41] <Joeskyyy> Ah, you can use getcollection, i.e. db.getCollection("derp test").find()
[20:46:37] <ryansteckler> Hi all, I'm trying to figure out a query. I have a model of a car with a passenger. I want to let Alice atomically get in the passenger seat only if there isn't a passenger already. She doesn't want to sit on someone's lap. So far, so good. The problem is that I can't figure out how to make sure she's not already in another car's passenger seat. I have this: findAndModify({id: carId, passenger: {$exists: false}}, {passenger: "alice"})
[20:46:46] <ryansteckler> But this obvisouly lets her get in another car, as well.
[20:47:11] <CaptainFantastic> So I’m getting started with mongo and I’m curious if most people use the CLI or other interfaces? Ex. Stackoverflow gives this as an example for changing user permissions and it feels really non-intuitive :) So what’s the received wisdom … db.users.update({"user" : "testAdmin"}, {$addToSet: {'otherDBRoles.TestDB': 'dbAdmin'}}, false, false)
[20:48:59] <Joeskyyy> CaptainFantastic: Kinda depends on what you're doing? Are you talking about specifically for user administration?
[20:50:00] <CaptainFantastic> Joeskyyy: Kind of all together, right? Is it common to use GUI tools for admin stuff?
[20:50:13] <CaptainFantastic> Or are there thousands of people going: db.users.update({"user" : "testAdmin"}, {$addToSet: {'otherDBRoles.TestDB': 'dbAdmin'}}, false, false)
[20:50:18] <ryansteckler> I thought about or'ing the query with something like {passenger: "alice"}, then failing the update if it returns more than one row, but findAndModify doesn't do that on multiple results. It modifies one of them, and since it's atomic, I can't check, then go ahead with the modify.
[20:50:44] <ryansteckler> (sorry if someone said something in response - client Dcd for a sec…)
[20:51:31] <Joeskyyy> CaptainFantastic: I mean if I'm importing a whole bunch of users or something, then I'll script it. But for most of my DBA style stuff I use the CLI.
[20:52:09] <Joeskyyy> ryansteckler: You'd probably want to two step that.
[20:52:23] <CaptainFantastic> Joeskyyy: Cool, thanks.
[20:52:49] <Joeskyyy> Something like "if not db.users.find({passenger: "alice"})" then proceed with the update
[20:53:23] <Joeskyyy> If I'm understanding your project correctly.
[20:54:33] <Joeskyyy> Although I wonder if you can use $and in your query operation in findAndModify...
[21:12:58] <swak> Anyone know how to delete a field in a document by targeting the key?
[21:14:55] <Moon_Man> Hello folks. I'm looking to populate a mongoDB running on heroku with data from an HTML webpage. Any pointers or advice?
[21:15:02] <Moon_Man> Really having a hard time with this.
[21:15:13] <Joeskyyy> swak: How do you mean?
[21:15:55] <cheeser> swak: $unset
[21:16:26] <swak> functions.insertData('user2', {c:'d'});
[21:16:27] <swak> How would I delete 'c' later on?
[21:16:40] <Joeskyyy> ^ +1 to cheeser
[21:17:31] <swak> So I've found this but how would I use it to target the key instead of the value? http://docs.mongodb.org/manual/reference/operator/update/unset/
[21:17:39] <cheeser> what?
[21:17:50] <swak> {field:'value'}
[21:18:03] <Joeskyyy> field is the key
[21:18:03] <swak> everything I see so far targets the value
[21:18:13] <swak> How do I target it?
[21:18:26] <cheeser> "targets the value?" "targets the key?" what do these phrases even mean?
[21:18:27] <Joeskyyy> So for your example db.foo.update({$unset:{c:""}})
[21:19:20] <Joeskyyy> errr, rather db.foo.update({c:'d'}. {$unset:{c:""}})
[21:19:52] <Joeskyyy> The first part ({c:'d'}) is targeting the document where c:'d' is true.
[21:21:14] <swak> That's the problem, I want to be able to do this without knowing what it is
[21:21:39] <Joeskyyy> You mean without knowthing the value of c?
[21:21:43] <swak> yeah
[21:21:46] <Joeskyyy> But knowing that the field "c" exists?
[21:21:51] <swak> yeah
[21:21:55] <Joeskyyy> $exists
[21:22:19] <swak> targ.update({c:$exists},{$unset:{c:""}});
[21:22:25] <swak> is that it?
[21:22:31] <cheeser> db.foo.update({}, {$unset:{c:""}})
[21:22:48] <Joeskyyy> First part change that to {c:{$exists:true}}
[21:22:59] <Joeskyyy> Cheeser's would work as well, but would scan all documents for that.
[21:23:27] <Joeskyyy> Well, if you're not indexing on c I suppose it would regardless eh
[21:23:32] <cheeser> it would
[21:23:38] <Joeskyyy> yeah.
[21:23:40] <Joeskyyy> Screw $exists
[21:23:40] <Joeskyyy> lol
[21:24:01] <Joeskyyy> If you're indexing on the field you're unsetting, use $exists however
[21:24:39] <cheeser> agreed.
[21:25:15] <swak> It works :)
[21:25:20] <Joeskyyy> w00ts
[21:25:50] <swak> the next thing that I'm wondering is a document entry only contains the id, how do I delete it?
[21:26:57] <swak> so if a document only contains 1 field (which is the id) it should be deleted
[21:29:41] <Joeskyyy> not that I can think of? I'd imagine you'd have to script that some how, unless cheeser knows something awesome
[21:30:23] <swak> How do you target it in the first place?
[21:30:46] <swak> Wait a sec
[21:31:52] <swak> hmm, So in other word, how to delete a document
[21:33:54] <BurtyB> collectionname.remove({_id:'blah'})
[21:34:53] <swak> hmm, now the only thing is to get the id of a collection that only has one field
[21:35:17] <BurtyB> magic!
[21:35:22] <swak> lol
[21:35:58] <CaptainFantastic> Is my understanding correct that if you are using vanilla Mongo (non SSL) and are accessing remotely, all the data + user authentication is being passed plain text and is thus a massive security hole?
[21:36:37] <BurtyB> swak, if you know all of the fields that might exist you could check for their existance but that's going to be horrid imho
[21:36:52] <swak> hmm
[21:37:17] <Joeskyyy> swak
[21:37:45] <Joeskyyy> I just whipped up this java scrip function that works for me one a collection where I had some that just had a few docs with just an _id
[21:38:03] <swak> alright
[21:38:15] <Joeskyyy> I recommend verifying on a test db before you run it on anything important
[21:38:18] <Joeskyyy> http://pastebin.com/172rkyM9
[21:38:31] <Joeskyyy> It looks at the keys.length function to find out how many keys a document has
[21:38:50] <Joeskyyy> If it only has one key (since every doc needs at least 1 key, an _id) it should remove only the docs with _ids
[21:45:18] <Joeskyyy> CaptainFantastic: To answer your question simply, yeah. It's just a basic TCP connection so it's all getting sent plain text over the wire.
[21:47:42] <swak> Joeskyyy: I'm getting this error: TypeError: Object #<Cursor> has no method 'forEach'
[21:49:02] <Joeskyyy> Hmmm, works just fine on my end
[21:49:45] <Joeskyyy> http://pastebin.com/qsxhFStN
[21:50:34] <swak> is this being done by the console directly?
[21:50:39] <swak> or through node
[21:50:44] <Joeskyyy> Through the console directly.
[21:50:51] <swak> I should have specified that earlier I think
[21:50:53] <swak> sorry
[21:50:57] <Joeskyyy> Quite alright.
[21:50:59] <cheeser> CaptainFantastic: correct. which is why shouldn't do that.
[21:51:25] <Joeskyyy> I'm actually not familiar with the node drivers, so I'm not sure how you'd accomplish that with the object returned :\
[21:51:34] <swak> hmm
[21:52:59] <Joeskyyy> You can however, load that in a local javascript file, and invoke it in your node.js code? I'm not gonna lie I'm very ignorant when it comes to node
[21:53:06] <Joeskyyy> Really need to learn it, just haven't taken the plunge
[21:57:52] <Joeskyyy> swak: can you try .each instead of forEach?
[21:58:37] <Joeskyyy> Looks like a Cursor obj in the node.js drivers has that availability. "cursor.each(function(err, doc){}) retrieves all matching records one by one.
[21:58:38] <Joeskyyy> "
[21:59:00] <swak> lol
[21:59:02] <swak> nice
[21:59:19] <Joeskyyy> Why they don't stick with standard javascript is beyond me -_- but whatever.
[21:59:41] <swak> lol
[21:59:52] <Joeskyyy> Hopefully that should do it for ya.
[22:00:03] <swak> true
[22:04:30] <swak> hmm
[22:04:39] <swak> for some reason the remove function isn't doing anything
[22:08:27] <Joeskyyy> You changed it to match your node js stuff right?
[22:10:39] <swak> yeah
[22:10:52] <swak> I'm confident it is
[22:11:41] <Joeskyyy> And stupid question, you changed it from db.test.remove to db.your.collection.remove right? :P
[22:12:15] <swak> I'm pasting my code up right now.
[22:12:20] <swak> as to what I'm doing
[22:12:29] <swak> http://pastebin.com/7i2khfbg
[22:12:52] <swak> btw, function (err, inserted) {} is needed
[22:13:18] <swak> otherwise it errors out and complains about a callback
[22:14:11] <swak> So in other words, this function checks to see if the collection has any extra keys left after deleting one.
[22:18:18] <Joeskyyy> Does it actually log the lengths? Like print them out?
[22:18:30] <swak> it does
[22:22:36] <Joeskyyy> Have you considered using eval?
[22:22:51] <swak> I haven't
[22:23:05] <Joeskyyy> Derick: Doesn't like this idea.
[22:23:07] <ruphos> swak: doesn't look like remove is submitting a query param. have you tried target.remove(_id:doc._id)?
[22:23:25] <Joeskyyy> Praise jesus someone who knows the node drivers haha
[22:23:36] <Derick> that's not me
[22:23:44] <Joeskyyy> ruphos I meant :P
[22:27:01] <swak> ruphos: that doesn't seem to do anything either.
[22:28:41] <Joeskyyy> If all else fails, eval should do it, http://mongodb.github.io/node-mongodb-native/api-generated/db.html?#eval i've used it in python before. of course you'd need to make a connection inside the eval to mongo and your db
[22:31:06] <ruphos> hmm. I don't write the node, but I have to deal with when it fails. lemme grep through some source and figure out how we handle that
[22:32:13] <swak> still no effect: db.eval('db.test.find().forEach( function(doc) {if (Object.keys(doc).length ==1) {db.test.remove(doc)} })', function (err, inserted) {});
[22:32:29] <swak> Still no effect wrapping the original function in eval
[22:32:32] <Joeskyyy> You need to open a connection inside the eval.
[22:32:44] <swak> dang
[22:32:51] <Joeskyyy> Yeah, it's a whole thing.
[22:33:21] <Joeskyyy> db.eval(' conn = new Mongo(); db.conn.getDB('foo'); …….'
[22:33:31] <Joeskyyy> err
[22:33:35] <Joeskyyy> db = conn.getDB rather
[22:33:39] <Joeskyyy> I need more caffeine.
[22:39:12] <ruphos> swak: are you using the native node mongo driver or are you using mongoose as well?
[22:39:24] <swak> just mongo
[22:40:15] <swak> is mongoose nicer to work with?
[22:40:31] <ruphos> eh. it helps act as an orm
[22:40:37] <swak> orm?
[22:40:48] <ruphos> object relational model / mapping
[22:41:00] <ruphos> it can simplify things if you use it correctly
[22:41:04] <swak> I see
[22:43:19] <ruphos> you should be able to do "target.remove({field: value}), function(err, r){});"
[22:43:36] <ruphos> are you wrapping the "field: id" part in {}?
[22:44:01] <swak> yeah, it errors out otherwise
[22:44:57] <swak> target.remove({_id:doc._id}, function (err, r) {});
[22:46:00] <ruphos> try logging doc._id with the key length to make sure that's actually being accessed right
[22:46:43] <swak> of course. undefined
[22:46:52] <ruphos> aha
[22:46:57] <ruphos> try doc.id
[22:47:08] <ruphos> I've seen in it referenced both ways in our code
[22:47:23] <swak> nope
[22:47:30] <ruphos> boo
[22:47:44] <ruphos> can you dump the whole object into the log?
[22:49:08] <swak> doesn't provide the needed info
[22:49:20] <swak> in the database it is _id
[22:50:01] <Joeskyyy> Can you return what type doc._id is?
[22:50:19] <ruphos> good point, it could just be storing at str instead of ObjectId
[22:50:46] <Joeskyyy> According to the docs itts a 12 byte binary hash. If you wanna treat it as a string you need to convert it to a hexString
[22:50:52] <Joeskyyy> Totally grasping at straws here
[22:52:04] <ruphos> super ghetto hack, but this could work: Object.keys(doc).forEach( function(key) {target.remove(_id: doc[key])})
[22:52:07] <swak> it shows up as an object
[22:53:15] <Joeskyyy> Wat.
[22:54:52] <Joeskyyy> Try ruphos' idea. If not, maybe try something similar to this inside the if statement: http://mongodb.github.io/node-mongodb-native/markdown-docs/queries.html#id-values
[22:55:20] <Joeskyyy> the toHexString part that is.
[22:55:33] <Joeskyyy> That way your query is actually using a string of doc._id
[22:56:38] <ruphos> ^ would be ideal
[22:57:15] <ruphos> perl driver does not have this issue. ;)
[22:57:25] <Joeskyyy> python doesn't either haha
[22:57:52] <ruphos> Joeskyyy: ^5
[23:03:57] <ruphos> swak: any luck?
[23:04:34] <rafaelhbarros> what are you trying to do with pymongo?
[23:04:40] <Joeskyyy> Nufin.
[23:05:01] <Joeskyyy> Tryin to get swak's NodeJS stuff to work as intended :P
[23:05:25] <rafaelhbarros> oh, node.js
[23:06:31] <swak> doc._id comes out as undefined :(
[23:17:50] <Joeskyyy> well, that could be an issue haha
[23:18:14] <swak> no kidding
[23:18:48] <Joeskyyy> What happens if you log doc? Does it present anything of significance?
[23:19:19] <swak> nothing of significance.
[23:19:32] <swak> doing a typeof on doc returns Object
[23:20:24] <swak> er wait
[23:21:18] <ruphos> how about: console.log("doc: %j", doc);
[23:21:24] <Joeskyyy> It's something to do with the cursor object with "doc" that we're loading it :\\
[23:22:25] <swak> {"name":"MongoError"}
[23:23:08] <ruphos> well that would do it
[23:55:35] <kaushalparikh> ranman: sup dog?