PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Wednesday the 11th of February, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:00:10] <hicker> Yes, but only if field2 != "String2"
[00:00:26] <joannac> incorrect
[00:00:35] <joannac> wait
[00:00:38] <joannac> correct
[00:00:47] <joannac> wait
[00:00:49] <hicker> See? It's confusing :-)
[00:00:51] <joannac> oh my god
[00:01:22] <joannac> if field1 = "String1" and field2 !=String2
[00:01:32] <joannac> the AND bit returns true, and the $not makes it false
[00:01:36] <joannac> so not, it's not returned
[00:01:48] <joannac> okay, to make this simpler
[00:01:55] <joannac> how do you make the AND bit false?
[00:02:15] <NaN> n3b-: just curious, are you using a caped collection for the logs?
[00:02:57] <n3b-> NaN: nope
[00:03:17] <hicker> I could use $in with an enum I suppose
[00:03:54] <n3b-> NaN: but I will have a look. :)
[00:03:54] <joannac> hicker: what?
[00:03:58] <hicker> But would rather not, just because I'm not sure of all the possible values quite yet
[00:04:06] <joannac> hicker: just answer my question
[00:04:27] <hicker> I'm not sure :-( You have to $not the who expression?
[00:04:30] <hicker> *whole
[00:05:09] <hicker> Oh, use $or?
[00:05:15] <joannac> hicker: yes
[00:05:22] <joannac> that's where I was trying to get you to go
[00:05:23] <hicker> Ohhh
[00:06:22] <hicker> Let me try
[00:08:47] <hicker> joannac: You are wonderful
[00:09:49] <hicker> And a super genius too. I should pay you for your support :-)
[00:12:37] <hicker> Thank you very much
[00:12:39] <joannac> :)
[00:13:25] <n3b-> thanks for your answers. ;)
[01:19:31] <haole> if most of my documents share, let's say, the same four fields, but some of them have extra unique fields to themselves, should I worry about optimizations upfront?
[01:19:36] <haole> I hope the question made sense :D
[01:41:21] <unholycrab> having an issue with mongodb 2.4.7 not storing utf-8 characters correctly
[01:41:35] <unholycrab> trying to dig up some more details
[01:41:46] <unholycrab> im not actually sure where in the pipeline its being stored like this
[02:13:35] <giowong> hi anyone here familiar with monk?
[02:23:02] <cheeser> i loved that show
[02:27:21] <giowong> lol i meant the framework :P
[02:27:27] <giowong> for mongodb
[02:27:31] <cheeser> oh. never heard of it.
[05:08:43] <giowong> hi anyone here?
[05:26:24] <Boomtime> hi giowong!
[05:26:31] <giowong> hi!
[05:26:43] <giowong> are you familiar on how to use d3js with mongodb by anychance?
[05:27:01] <giowong> currently im using a independent csv file
[05:27:09] <giowong> but i want to put into json for my project
[05:27:38] <Boomtime> nope sorry, but you'll find json quite friendly to work with mongodb
[05:27:56] <Boomtime> it sounds like you need help with the "csv to json" part
[05:29:05] <giowong> oh
[05:29:08] <giowong> yeah good idea thank you!
[05:33:48] <joannac> mongoimport ?
[05:36:27] <Boomtime> giowong: joannac is suggesting you try mongoimport, it can parse csv under strict conditions and make documents from each row, you may find it suits your needs
[06:07:11] <fhain> good morning MongoDB scum
[06:08:09] <fhain> why are you mongodb? Just because it fits your little brains?
[06:10:12] <fhain> I guess that the sum of your IQs here is less than the IQ of a pig
[06:10:21] <fhain> horrible IT workers here
[06:10:33] <fhain> idiots using idiot software
[06:10:41] <fhain> MongoDB: FROM ASSHOLES FOR ASSHOLES
[06:10:43] <fhain> HARHAR
[06:44:31] <giowong> uh ok
[07:47:04] <jerev> I have a date object in my data, that looks like {..., "dt": {"$date": "2015-10-02T15:15:00.000Z"}, ... } -- How do i match on this?
[07:47:28] <jerev> When I write a simple $match { dt { $gt: ... } } } it doesn't seem to give the correct results
[07:48:02] <kali> jerev: what do you put in place of the ... :)
[07:48:10] <jerev> Other properties
[07:48:23] <jerev> Oh, in the gt
[07:48:30] <kali> this is probably where you're wrong actually. show us the date format you use in the query
[07:48:53] <jerev> I use a javascript toDate() to save my objects, and the same to retrieve them
[07:50:04] <kali> ok. i'm guessing node.js and i'm not that fluent in that stuff. but it is supposed to work.
[07:50:25] <jerev> I tried isostrings like "2015-02-11T06:47:35.970Z" too. And that doesn't return anything either
[07:50:30] <kali> jerev: if you read the document in the mongo shell, how does the date show ? ISODate(...) ?
[07:50:47] <jerev> Well, correction, the isostrings don't return anything
[07:50:54] <jerev> the toDate() 's return all records
[07:51:03] <jerev> So the "gt" doesn't apply
[07:52:31] <jerev> I believe the issue is that my objects are saved as "dt" with an inner "$date"
[07:53:35] <kali> jerev: this is why I asked about how the date appears in the shell. it should show as "dt":ISODate("...")
[07:55:37] <jerev> "dt" : ISODate("2015-10-02T20:00:00Z"),
[07:56:54] <kali> ok, this is fine for the format. you're aware it is 9 monthes in the future ?
[07:57:29] <kali> i mean, this is what you're expecting, right ?
[07:57:53] <jerev> Right... how did I miss this.
[07:58:06] <jerev> Ehh
[07:59:02] <kali> :)
[07:59:07] <kali> so problem solved ?
[07:59:17] <jerev> Most likely, if I can fix the saving :)
[08:01:04] <kali> most likely you're swapping month and day of month somewhere
[08:01:22] <kali> can be local related if you parse date from so called human readable format
[08:01:29] <kali> s/local/locale/
[08:06:10] <jerev> kali: thanks for your help. I wouldn't have spotted that one.
[08:06:18] <jerev> Not without a lot of misery anyway.
[08:06:59] <kali> you're welcome
[09:08:04] <durre> is it a bad idea to do querys like this: {authorId: {$in: [id1, id2, id3 ...]}} ... I expect the list to normally be around 30 ids and maybe at most 100-150
[09:12:03] <kali> durre: this is fine. certainly better than performing individual queries for each author
[09:12:04] <durre> and the collection will probably hold ~1 million documents
[09:12:45] <kali> you certainly need and index on authorId though
[09:12:52] <durre> yes ofc
[09:13:31] <durre> thanks for the input
[11:27:52] <Faved> hey all, can anyone tell me, I am messing around with using TTL on some mongo indexes, but I wonder if there is a way to make them slide? so if I set a TTL of say 2 mins on doc when I add it, can I call something which will make the 2 min "reset" ?
[11:31:33] <kali> yeah. use a "death_date" with a ttl of 0
[11:32:09] <Faved> ok cool Ill have a look
[11:32:23] <kali> just set the death_date in 10 minutes in the future (if that's the actual TTL you want) when you insert, and update it at 10 minutes in the future when you want to prolong your document life
[11:32:46] <kali> death_date is an arbitrary name, don't look for it in the doc
[11:33:48] <Faved> so using that technique, if i have a doc which is orginally set for say 5 mins, am I amble to prolong that ttl indefinitely.
[11:34:03] <Faved> I am using something using Redis at the moment and I am looking at using mongo instead
[11:34:11] <Faved> I store a user token for a ruby API
[11:34:26] <Faved> which is supposed to expire after 5 mins, unless there is some interaction
[11:34:34] <Faved> in which case it doesnt expire
[11:34:50] <Faved> until there has been no interaction
[11:35:18] <kali> well, another option, use a 5min TTL on last_interaction, and update last_interaction every time there is an interaction
[11:35:50] <Faved> ah yes
[11:36:06] <Faved> by using clock time on here? http://docs.mongodb.org/manual/tutorial/expire-data/
[11:37:17] <kali> mmm actually "clock time" is closer to the death_date approach, but both will work
[11:38:33] <Faved> I did try setting TTL of 5 mins on a flield and then tried updating that field to see if it "slid"
[12:03:42] <Faved> @kali Thanks updating the field in which the TTL was on (a date field) worked a treat
[12:30:25] <Hypfer> any way to say "please give me only every 5. result" ? or even better: "return results but only average for every 5" ?
[12:31:43] <BnS> not possible except within your own code
[15:03:39] <fhain> Docker is nothing than the stinking excrements of Solomon Hykes
[15:04:26] <StephenLynx> yeah, docker is shit.
[15:04:32] <StephenLynx> but what does it has to do with mongo?
[15:04:43] <StephenLynx> hey, I was pretty sure I had you on ignore.
[15:08:37] <queretaro> Hi, I've created an admin user in a single DB but I noticed that I still can access the DB without any credentials, how could I restrict that to only the admin?
[15:12:36] <salty-horse> hey. is there a way to tell mongodb to only match documents whose list field contains all provided elements? the $in operator provides an OR relation. I'm looking for AND
[15:13:22] <Derick> salty-horse: there is $all
[15:13:23] <kali> salty-horse: $all
[15:14:15] <salty-horse> thanks! is there a similar thing for the $text operator? e.g. only matching strings that contain several provided words?
[15:33:54] <jthomas_> Good day, I'm back with a few questions. I set up DBs yesterday and userAdmin but those userAdmin roles apparently can'
[15:34:00] <jthomas_> t actually use the database
[15:34:15] <jthomas_> Ok so I have to set up readWrite perms, no sweat
[15:34:18] <jthomas_> i though
[15:34:19] <jthomas_> t
[15:35:06] <jthomas_> Can anyone explain how to do that? I wanted to give more perms by rerunning the command but Mongo says the account exists (yes it does). Figured out how to drop the account, now I want to re-add it with userAdmin perms AND readWrite perms.
[15:35:21] <jthomas_> I have four different DBs for this user
[15:36:06] <jthomas_> looking at the docs, it seeems to tell me to change to the DB that I want to affect, and run the db.createUser() command, but then it starts granting roles in unrelated DBs http://docs.mongodb.org/manual/tutorial/add-user-to-database/
[15:36:41] <jthomas_> why do I change to a DB if the roles are for other DBs? Do I have to change to each of my 4 and grant perms to all the others within each of these?
[16:39:48] <cypas> hi all
[16:40:11] <cypas> can anyone give me a lead on how to save a file with \n in mongo db?
[16:40:23] <cypas> whats the best approach: String ?
[16:43:58] <cypas> lower than 1MB
[16:46:46] <fhain> Gridfs or as binary type
[16:49:03] <kali> string can work too, if it is correctly escaped
[16:52:33] <cypas> I was trying to escape just for testing but cant find a way
[16:52:43] <fhain> you know your options
[16:54:16] <cypas> :)
[16:54:24] <kali> cypas: well, it depends how you access mongodb, but the driver interface should escape for you
[16:59:15] <fhain> just read the docs or google, everygthing is documented
[17:09:35] <roadrunneratwast> I have a bunch of geographical data. Are there any mongo tools or packages for searching by location? Eg. A 10 mile radius from location X?
[17:10:22] <fhain> roadrunneratwast ever googled????
[17:10:33] <roadrunneratwast> lol
[17:10:38] <roadrunneratwast> love you
[17:10:44] <roadrunneratwast> okay. will do, mildew
[17:10:58] <cheeser> mongo supports geo queries, fwiw
[17:11:15] <roadrunneratwast> ok. i will look into it. sorry for the RTFM question
[17:11:43] <fhain> A lazy asshole question
[17:11:57] <fhain> Typical for mongodb tards
[17:13:14] <obeardly> fhain: why are you so angry
[17:13:29] <fhain> Your thing for me attitude sucks
[17:16:12] <obeardly> fhain: http://youtu.be/d-diB65scQU
[17:20:18] <fhain> http://www.31337.pl
[17:22:05] <StephenLynx> mongo killed his dog and touched in funny places :v
[17:22:10] <StephenLynx> touched him*
[17:24:08] <fhain> the idiot has gone
[17:24:10] <fhain> great
[18:25:27] <tubbo> hey all, having a bit of an issue when i attempt to access my mongodb database. "exception: BSONObj size: 0 (0x0) is invalid. Size must be between 0 and 16793600(16MB) First element: EOO"
[18:25:35] <tubbo> this occurs when i run `db.dropDatabase()` from within the console
[18:26:35] <tubbo> https://gist.github.com/tubbo/0b055d0bc61e1bae2227
[18:27:48] <StephenLynx> couldn't reproduce.
[18:27:52] <StephenLynx> what version are you using?
[18:28:06] <tubbo> StephenLynx: 2.6.7
[18:28:23] <tubbo> StephenLynx: do you think it might be a data issue? this is the only DB i get an error on, my other DBs are fine
[18:28:37] <StephenLynx> no idea, man.
[18:28:45] <cheeser> what does db.stats() say?
[18:29:05] <tubbo> cheeser: same error
[18:29:13] <tubbo> this is definitely a data issue of some kin
[18:29:16] <tubbo> kind*
[18:29:24] <cheeser> try db.repairDatabase() ?
[18:29:26] <Nilium> > db.stats()¬ {¬ msg: "OH NO"¬ }¬
[18:29:33] <tubbo> i can't access ONLY the test db at all. and this started when someone migrated my data from one machine to another :)
[18:29:47] <tubbo> cheeser: same error
[18:29:52] <tubbo> Nilium: basically :D
[18:30:02] <cheeser> well. sounds truly trashed.
[18:30:12] <tubbo> where does mongo store its information? perhaps if i blew away the data dir and re-built everything this would work?
[18:30:30] <cheeser> depends on your mongo.conf
[18:30:41] <Nilium> tubbo: Didn't you invite me to twitter ages ago?
[18:30:49] <Nilium> Are you to blame or was that some other person
[18:30:52] <tubbo> Nilium: i dunno maybe
[18:31:04] <Nilium> I know it was someone on SA so who knows anymore.
[18:31:04] <tubbo> Nilium: your name sounds familiar, do you hang in #rubyonrails or ##javascript?
[18:31:11] <tubbo> oh that's where i know you from lol
[18:31:13] <tubbo> SA :)
[18:31:16] <Nilium> Nope. You follow me on Twitter.
[18:31:31] <tubbo> i don't remember twitter being invite-only
[18:31:47] <Nilium> Well, you probably also know me from SA, but I don't think anyone knows my SA name. I try to make sure it's unassociated with everything else.
[18:32:33] <Nilium> Randomly popped into my head.
[18:33:14] <tubbo> that's funny
[18:33:16] <tubbo> small world
[18:33:29] <tubbo> cheeser: blowing away the data for my test db fixed it...must have been a bad copy or something.
[18:39:32] <cheeser> probably
[18:39:42] <cheeser> glad you got it cleaned up
[18:42:21] <heewa> So, if I get an InvalidBSON error from pymongo read operation, is that something I should dig into (like is it a bug in mongo/pymongo?) or just sometimes happens?
[18:42:59] <heewa> (That sounds snarky, I meant it non-sarcastically. honestly wondering if it’s just fritzy like that sometimes)
[19:31:38] <worldwide> hello :-) sorry for this question but is it possible to combine $and and $or in a mongodb query?
[19:32:51] <StephenLynx> probably.
[19:32:55] <StephenLynx> did you try?
[19:34:12] <worldwide> not really
[19:34:19] <worldwide> should i?
[19:34:34] <StephenLynx> well, I assume you want to do that, since you are asking.
[19:34:56] <worldwide> i'm sorry. i will try it. shame on me.
[19:36:37] <StephenLynx> :v
[20:06:40] <juanlas> hey yall, so quick question, is there any overwhelming reason to use the native mongo Date type instead of just storing an ISO date string?
[20:07:08] <GothAlice> juanlas: All of the ways in which you can query the data go pif if you store it in a non-native date format. Not to mention how inefficient storage as a string would be.
[20:07:52] <GothAlice> A la: http://docs.mongodb.org/manual/meta/aggregation-quick-reference/#date-expressions
[20:09:14] <juanlas> ah cool, thanks GothAlice, i am trying to explain to a developer why someone would want to use native types
[20:09:19] <GothAlice> '2015-02-11T20:06:11.820952' = 26 bytes, plus null, plus 4-byte leading length = 31 bytes to store this date.
[20:10:12] <GothAlice> Vs. native = 8 bytes.
[20:10:37] <mango_> what's the purpose of $setOnInsert
[20:10:58] <GothAlice> mango_: Upserts. Where you want to update a record if it exists, but create it otherwise.
[20:11:10] <GothAlice> $setOnInsert allows you to specify "default values" to use when creating a record in this scenario.
[20:13:11] <mango_> @GothAlice I see, ok, where is this set, is there an example?
[20:13:36] <GothAlice> mango_: http://docs.mongodb.org/v2.6/reference/operator/update/setOnInsert/
[20:13:52] <mango_> ok, thanks, one moment, I'll have a read.
[20:18:15] <mango_> GothAlice: If the record (document) doesn't exist, then can defaults (values) be applied?
[20:18:30] <GothAlice> That's what $setOnInsert does.
[20:18:56] <GothAlice> From the first paragraph of the link I gave: "If an update operation with upsert: true results in an insert of a document, then $setOnInsert assigns the specified values to the fields in the document. If the update operation does not result in an insert, $setOnInsert does nothing."
[20:23:45] <mango_> GothAlice: however if upsert:false, and a record exists then we do nothing right?
[20:25:27] <GothAlice> if upsert is false, $setOnInsert will either error (no point supplying it) or gracefully do nothing, regardless. (If the record didn't exist, with upsert: false, nothing would happen anyway.)
[20:29:01] <mango_> GothAlice: ok makes sense, thanks for the explanation.
[21:06:50] <worldwide> thank you StephenLynx, after i tried it it works,.... i'll promise i will test it next time before i ask :-)