PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Wednesday the 2nd of December, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[14:49:21] <fish_> hi
[15:23:28] <christo_m> How can i make a regexp that uses a variable
[15:23:44] <christo_m> all the examples i see for mongo regex are like find({ name: /whatever/i}
[15:24:06] <christo_m> but i have a variable with the string i want to match against.. basically a case insensitive LIKE
[15:24:31] <deathanchor> christo_m: eval()?
[15:24:49] <christo_m> deathanchor: example?
[15:25:28] <christo_m> deathanchor: http://pastie.org/10598591
[15:25:30] <deathanchor> christo_m: var cursor = eval('db.collection.find({ whatever : /'+ yourvar +'/ })')
[15:25:30] <christo_m> trying to do sometihng like this
[15:27:26] <christo_m> deathanchor: ya i dunno about that modification on my code there
[15:27:29] <christo_m> deathanchor: sec..
[15:27:56] <christo_m> deathanchor: https://gist.github.com/christomitov/85ef028150b2e57fb073
[15:28:25] <deathanchor> but basically, make a string of the command you want to run with the var concated in.
[15:28:35] <deathanchor> then eval that string (basically run the string as a command)
[15:28:36] <christo_m> deathanchor: ya but i have a callback tehre
[15:28:42] <christo_m> is there an easier way?
[15:28:44] <christo_m> eval seems hacky
[15:29:00] <deathanchor> that's the only way I know of in JS.
[15:29:10] <christo_m> is that how you do case insensitive queries?
[15:29:45] <deathanchor> /regexp/i
[15:30:07] <christo_m> ya exactly.
[15:30:31] <christo_m> eval("Genre.findOne({name: /"+genre+"/i }, function(err, genre) {
[15:30:31] <christo_m> ids.push(genre._id);
[15:30:34] <christo_m> })");
[15:30:45] <christo_m> ??
[17:11:33] <\monster\> Hi guys, I have no experience with mongo but need to grab an existing site that uses it and replicate on dev server. Can I simply copy the data directory from the live, linux, server while it's running without affecting anything?
[17:15:40] <StephenLynx> if the file doesn`t change during the copy, probably.
[17:15:50] <StephenLynx> using mongodump would be the safest way to do that, thougj.
[17:15:55] <StephenLynx> how large is the database?
[17:20:50] <bla> This conversion: "loc:[0.1, 0.2] --> { type: "Point", coordinates: [ 0.1, 0.2]}" - can't be done with update and I can use forEach loop - can someone acknowledge?
[17:25:51] <\monster\> I see .0 and .1 files ..they are 128mb 64mb ..pretty small
[17:28:31] <\monster\> should be able to copy this pretty much instantly
[18:07:28] <roonie> i have a collection of user ids and a collection of objects each of which has an array of user id references. I need to find all the objects in that collection that have any value from the user id array in its array of user id references
[18:08:14] <roonie> I tried this, but it's returning an empty array: http://jsfiddle.net/er75ekg3/
[18:08:43] <roonie> and i actually know why it's returning in empty array (authorizedUsers is an incorrect property parameter for that query)
[18:09:07] <roonie> anyone have any better ideas?
[18:09:45] <roonie> sorry, i refactored that jsfiddle to look more readble: http://jsfiddle.net/er75ekg3/1/
[19:18:37] <leptone> i just created a user with these creds on mongolab and im getting this: https://gist.github.com/leptone/3d0eb920ca1b58ed49a8
[19:18:37] <leptone> anyone seen this before?
[19:18:37] <leptone> http://imgur.com/HnTWr4q
[19:20:47] <cheeser> you know you just pasted your password on the open internet?
[19:30:16] <leptone> no i made a one time password and pasted it into the open internet.
[19:30:31] <leptone> thx for the support tho cheeser.
[19:31:44] <cheeser> :)
[20:12:33] <saml> I have doc like this: {"http://foo.bar": 1} and it's hard to update cause key contains a dot
[20:13:01] <saml> https://docs.mongodb.org/manual/reference/limits/#Restrictions-on-Field-Names oh crap
[20:16:43] <StephenLynx> kek
[20:39:04] <troypayne> how can i enter lat/long into MongoDB at the command line without it rounding?
[20:39:15] <troypayne> in code they’re doubles, but i don’t know if there is a NumberDouble
[20:42:12] <cheeser> your driver won't round
[21:20:40] <steven322> hey guys, do i need to convert JSON documents to BSON before using mongoimport? complete noob here, my json document is ~26 megabytes
[21:23:37] <cheeser> mongoimport reads json not bson
[21:24:11] <steven322> oh ok, does it then store it as bson after reading it?
[21:26:36] <cheeser> everything *in* mongo is bson, yes.
[21:29:03] <steven322> thanks. the data im working with is geospatial data which is why it is so large. are there any standard practices to handle this like breaking up the file?
[21:29:13] <StephenLynx> no.
[21:29:15] <StephenLynx> however
[21:29:23] <StephenLynx> I suggest writing a script to import the data.
[21:29:44] <StephenLynx> instead of trusting mongoimport to interpret it.
[21:30:43] <steven322> will look into that. thanks
[21:55:50] <bilb_ono> can someone tell me if this is formatted correclty? result_cursor = db.tweets.find({"geo": {"$ne":"None"}})[0:5]
[21:55:59] <bilb_ono> specifically what I am passing into find.
[21:56:17] <bilb_ono> it doesn’t give me any errors yet I still get results where the geo element = None…
[21:56:30] <bilb_ono> I am using pymongo
[22:14:28] <bilb_ono> any ideas?
[22:14:48] <bilb_ono> also, I try null and that gives me the python error: NameError: global name 'null' is not defined.
[22:16:06] <cheeser> what are you trying to do
[22:16:07] <cheeser> ?
[22:17:56] <bilb_ono> I want to query a mongo database and return all the results for which the field “geo” is not null
[22:18:06] <bilb_ono> in the regular mongo shell, I can easily do b.tweets.find({"geo":{$ne:null}})
[22:18:38] <bilb_ono> however, I would like to do this with the pymongo library
[22:19:07] <cheeser> $exists
[22:19:31] <cheeser> though it might exist and still be null...
[22:19:50] <cheeser> oh!
[22:19:58] <cheeser> don't put None in quotes.
[22:20:14] <cheeser> {'$ne': None}
[22:21:53] <bilb_ono> no I get NameError: global name 'null' is not defined
[22:22:00] <bilb_ono> oh wait
[22:23:49] <bilb_ono> yeah. {“$ne
[22:24:13] <bilb_ono> {‘$ne’: None} still returns results where geo is None
[22:24:27] <bilb_ono> as does {‘$ne’: “None”}
[22:25:29] <cheeser> is None or "None" ?
[22:25:46] <cheeser> take that _id, and find() that document in the shell.
[22:25:51] <cheeser> s/in/with/
[22:25:57] <cheeser> see what it looks like there.
[22:28:22] <bilb_ono> for both cases, the return document has ‘geo’: None, not ‘geo’: ‘None’
[22:29:38] <cheeser> not in the shell it doesn't
[22:36:11] <bilb_ono> cheeser: oh whoops. ok its null
[22:36:34] <bilb_ono> when I found that document by its id, I can see that the returned from the shell has “geo”: null
[22:36:58] <bilb_ono> so does that mean I should do an $exists instead?
[22:37:14] <erebel55> I'm not sure if this is the right channel but I'm using connect-mongo to store sessions. But how would I go about using those sessions to relogin automatically?
[22:40:51] <cheeser> bilb_ono: null still counts as existing, i believe
[22:41:30] <bilb_ono> cheeser: so I want “$ne”: null
[22:41:58] <cheeser> yeah, in the shell.
[22:42:10] <cheeser> and "$ne": None in python, i believe
[22:43:06] <bilb_ono> in the shell yeah that works. in python “$ne”: None still returns results where “geo”:null
[22:43:49] <cheeser> strange
[22:44:07] <cheeser> sounds like a bug but you might find someone with more experience with how pymongo works
[22:44:30] <bilb_ono> yeah… the pymongo channel isn’t that active.
[22:44:54] <cheeser> mongodb-users is probably your best bet
[22:47:20] <bilb_ono> cheeser: is that an irc channel? It doesn’t seem to have anyone there
[22:48:46] <cheeser> mailing list
[22:49:00] <cheeser> https://groups.google.com/forum/#!forum/mongodb-user
[23:36:01] <SaintMoriarty> Hey
[23:36:30] <SaintMoriarty> can anyone help me to setup a query to remove all duplicates via specific field?
[23:36:55] <StephenLynx> i dont think you can do that on a single query.
[23:37:05] <joannac> run an aggregate and $group on the field
[23:37:22] <joannac> and then run a query for each value that has duplicates, and figure out which one should be kept
[23:44:21] <bilb_ono> for anyone interested, {"geo": {"$nin": [None]}} fixed my issue! perhaps a bug in $ne ??
[23:44:50] <SaintMoriarty> joannac, just did it not bad
[23:45:18] <SaintMoriarty> am I not seeing something here? StartDate: { $regex: '1/.*/2015' } is picking 11/ and 1/
[23:48:56] <cheeser> is StartDate really a string?
[23:50:30] <SaintMoriarty> yes
[23:50:59] <SaintMoriarty> this is my first iteration, I will be changing these later on.