[03:48:16] <msn> how do i restore a db after enabling authentication I am trying mongorestore -u <user> -p --drop -d <db> <directory with backup> but it keeps giving me unauthorized even though <user> has readWrite and dbAdmin rights
[03:51:18] <joannac> msn: in the current db and the resotred db?
[03:53:07] <msn> I have created <db> and a <user> with those 2 rights inthat DB
[03:57:48] <devdvd> Hi all, quick question. Did the way capped collections work between 2.4.5 and 3.0.6 change? the reason i ask is because im trying to migrate from 2.4.5 to 3.0.6 (3.0.6 is on a new server) and did a mongodump on 2.4.5, when i go to import into 3.0.6, i get this message "error creating collection searchCountsByMember: error running create command: exception : specify size:n when capped is true. Here is my searchCountsByMember.metada
[03:57:58] <devdvd> . Now I see the problem and I thinki know how to fix it (i fixed it on another one like this by defining a size). Is that the proper way to go about it or am i missing something?
[03:58:53] <devdvd> Update to this as i posted it earlier. thhe undefined size and capped variables, they also exist if i try to do a mongodump from the 2.4 version (i used the 3.0 version initially)
[03:59:13] <msn> joannac: doing a restore and checking
[04:00:55] <msn> this error occurs on start of restore https://paste.debian.net/313879/
[05:01:59] <svm_invictvs> So I'mr eading the BSON spec here and I'm a little confused becasue it tells me that the first four bytes of a document make up the document'slength
[05:02:28] <svm_invictvs> I've made a BSON document using the bson4jackson API and the first byte hs 0x1 and then four bytes representing the length. Is that a problem with my bson generator?
[05:08:11] <svm_invictvs> Or is BSON not on topic here?
[05:09:06] <Boomtime> @svm_invictvs: it's an OK topic
[05:09:32] <Boomtime> my reading of the spec suggests it should always start with the document length too, though i haven't actually played with BSON much
[05:29:32] <svm_invictvs> Boomtime: Yeah, that's how I read it.
[05:34:38] <Boomtime> svm_invictvs: does it end with a nul byte? (0x00)
[05:35:19] <Boomtime> i wonder if what you are looking at is an isolated e_list, whose first element is a double, rather than a properly formed document
[05:39:06] <svm_invictvs> Boomtime: I found my problem :-
[05:39:27] <svm_invictvs> Boomtime: Basically I was adding a byte at the beginning by accident.
[05:42:57] <svm_invictvs> Boomtime: But what I do find interesting is that each document, embedded or not, needs to be preceded with the length
[05:54:45] <svm_invictvs> Boomtime: Yeah, I realized I was writing a byte to the stream to indicate what type the document was and then I forgot to skip over that.
[05:55:02] <svm_invictvs> Boomtime: So I'm writing something that actually puts the BSON document in an envelope before sending it
[05:55:08] <Boomtime> ah, welp, that would be a you problem :p
[05:55:22] <svm_invictvs> Well, I just realized the document length is not used all the time
[05:55:26] <Boomtime> right, i take it it's working for you?
[05:55:27] <svm_invictvs> And that it's slow to serialize
[05:55:34] <svm_invictvs> Well not working, but I found the issue
[05:55:42] <Boomtime> heh, you are moving again...
[05:55:49] <Boomtime> that is often the best we can hope for
[06:37:46] <m3t4lukas> What is the best way in java to retrieve an Array as ArrayList from org.bson.Document?
[07:16:28] <fewknow> m3t4lukas: not familiar with java, but i am assuming you can issue a query to mongo and get back the entire json.....if you just want an array you can project in the query
[07:19:29] <m3t4lukas> That's what I've done. That returns the org.bson.Document. Now I want to put the data I retrieved to use. When I do ArrayList<Float> = doc.get("someFloatArray", ArrayList.class); I get a warning: "Type safety: The expression of type ArrayList needs unchecked conversion to conform to ArrayList<Float>"
[07:20:58] <m3t4lukas> and http://mongodb.github.io/mongo-java-driver/3.0/bson/documents/ does not say how to actually use those things. It describes how to put data in, but not how to get it out. A database only makes sense if you can work with retrieved data ;)
[09:55:21] <ragezor> Hello guys I'm having problems searching for regex in mongo shell
[11:01:58] <oskie> hello, I read on http://docs.mongodb.org/manual/faq/replica-sets/#how-long-does-replica-set-failover-take that failover takes 10-30s (detection) + 10-30s (election). In the case of a manual stepdown, I guess you will only get the 10-30s delay for election?
[13:16:38] <m3t4lukas> hi, how do I get an Array out of org.bson.Document in java?
[13:31:58] <m3t4lukas> When I do ArrayList<Float> = doc.get("someFloatArray", ArrayList.class); I get a warning: "Type safety: The expression of type ArrayList needs unchecked conversion to conform to ArrayList<Float>"
[13:35:10] <StephenLynx> shouldn't it be ArrayList<Float> var = doc.get...?
[13:35:20] <StephenLynx> where var is your variable name?
[13:35:57] <m3t4lukas> StephenLynx: yep, just forgot it here in IRC. No syntax highlighting :P
[13:36:11] <m3t4lukas> the variable has a name in the code
[13:36:30] <StephenLynx> did you tried casting the result of doc.get to ArrayList<Float>?
[13:40:10] <m3t4lukas> and the exception when I try to use whatever is in the ArrayList is also the same: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Float
[13:40:38] <StephenLynx> are you sure you should be using an arraylist of floats?
[13:42:29] <m3t4lukas> :o it is an array of double...
[13:49:21] <cheeser> m3t4lukas: that's just a generics warning. you should be fine with that.
[13:51:05] <m3t4lukas> cheeser: okay, I am, however, surprised that when I append an ArrayList<Float> onto a Document and store it into the database that it is being stored as a double
[13:51:37] <cheeser> bson only has the one floating point type.
[13:52:04] <cheeser> oh, and i just saw your CCE line. yeah. for that you'll need a List<Double>
[13:56:32] <m3t4lukas> cheeser: okay. maybe that's worth mentioning in the docs :)
[13:57:05] <m3t4lukas> cheeser: never mind, I just saw that float is not even listed
[14:22:28] <symbol> I've noticed a strong distaste for Mongoose when using Node.js but what about using Mongorito? I was checking it out earlier and it doesn't seem to get in the way.
[14:23:14] <symbol> Plus side is it's using mostly ES2015
[14:34:14] <m0rpho> hi there, I want to count about 1000 urls per seconds and then sort this data by occurence, ideally in realtime. do you guys have any suggestions about what kind of datastructure to choose?
[14:35:59] <m0rpho> I thought about just using update with upsert:true and a counter with $inc
[14:37:18] <symbol> Without knowing the details of your project, that seems like a viable option.
[14:37:49] <m0rpho> but then i wouldnt be able to know which url occured most of the time in say the last 60 minutes
[14:39:06] <cheeser> why not just insert them every time they occur then aggregate the last 60 minutes?
[14:42:43] <m0rpho> cheeser: thanks for your response! do you think mongodb is fast enought for that? it will be billions of rows. sorry if my question might sound stupid, im pretty new to mongodb
[14:48:08] <m0rpho> one last question: can I combile this grouping with a date filter? i.e. group all urls inserted the last 60 minutes and group by url and count each group by amount of same urls and sort by highest amount?
[14:48:54] <m0rpho> and combining that with a ttl index
[14:49:10] <m0rpho> I think then I would have a perfect trending algorithm
[14:51:26] <m0rpho> and are there wildcard matches for grouping? like regex?
[14:51:46] <Bajix> Can aggregate take the average of a variable without grouping? My projected data looks like { _id: 270, count: 24 }, { _id: 271, count: 26 } etc
[16:47:57] <cheeser> mongodb.org has docs on the geo support
[16:50:26] <rblourenco> I saw while reading the documentation that MongoDB has implemented a b-tree index. I would like to know if thermopilae has opensourced their SD-r*Tree index algorithm...
[16:51:18] <rblourenco> It was a presentation from Nicholas Knize from 2012...
[16:51:44] <rblourenco> I've tried to contact him, but still no response.
[16:53:34] <teknopaul> n00b question using nodejs driver, node-mongodb-native/2.0, any one know where I can find docs on how to create query objects for find(). The docs at http://mongodb.github.io/node-mongodb-native/2.0/api/ all have just find({}) I cant get anything else to work. MongoDB main site docs seem to be for some other driver.
[16:54:43] <oskie> teknopaul: check mongodb docs on find: http://docs.mongodb.org/manual/reference/method/db.collection.find/
[16:55:36] <teknopaul> is query object the same format?
[17:27:56] <cheeser> (i only know that because i was mucking around the other day and had the exact same questions :D )
[17:55:00] <Bajix> Is there any way to make something like $group: { _id: null, average: { $avg: '$count' } } result in a single object, rather than an array wrapping a single object?
[18:00:03] <StephenLynx> I don't see why is that a problem.
[18:00:24] <StephenLynx> you can see if you got stuff by checking if the results array has objects and then you just get results[0]
[18:00:49] <cheeser> though if you have a large response a cursor would be better.
[18:01:08] <Bajix> Well, my current design pattern is one in which I have a function that generates middleware from a function that returns an aggregate
[18:01:32] <Bajix> so I'd have to re-write that to add in a transform step
[18:07:40] <akoustik> not a big deal, but is there a way to do this with a single update(), but without $min, per the comment on line 4? https://gist.github.com/anonymous/4995c816337143092352
[18:08:24] <Bajix> what do you have against mongoose? I mean, other than the incompleteness
[18:08:51] <cheeser> akoustik: why do you have $min there?
[18:09:17] <cheeser> if you want to only create 'firstLogin' on the first upsert, use $setOnInsert
[18:09:50] <akoustik> cheeser: oh, well there ya go. yeah that's what i want. never saw $setOnInsert for some reason. thanks.
[18:10:20] <StephenLynx> it doesn't handle _id right, is 6x times slower
[18:10:27] <akoustik> cheeser: $min was just one of those "meh, it works" things. :\
[18:22:41] <akoustik> oops, ya know, i think $setOnInsert might not be exactly what i need. the document will actually be inserted without a value in the firstLogin field.
[18:23:15] <akoustik> so setOnInsert wouldn't apply if i'm understanding right. i guess i can at least test it first.
[18:46:52] <akoustik> yeah, looks like, unless there's something like "$setOnNewField" that i'm missing, looks like $min might be the way to go.
[18:49:46] <akoustik> er, i'll try to be more clear. i could probably be smarter, but right now, "users" might get inserted without a "firstLogin" field. so when the upsert from my gist runs, the document already exists, so $setOnInsert won't apply.
[18:50:17] <cheeser> why would you insert those docs without setting firstLogin?
[18:51:47] <akoustik> cheeser: i'm creating "users" with identifying information, before they log in.
[18:54:02] <cheeser> or go the other way: $set lastLogin and return the modified doc. if firstLogin is missing, do a $set on that field with the same date.
[18:54:36] <akoustik> i'll think about that. but for now, do you see any actual logical error with the way i'm using $min, other than that the comparison will always have the same result?
[18:55:00] <cheeser> i have no idea why $min is there or why it only works with it present.
[18:56:03] <akoustik> haha, well maybe it's a bad hack, but it works because the first value that gets set there is always in the past relative to `new Date()`
[18:57:17] <akoustik> yeah, ya know, your suggestions are definitely easy enough, i'll just change it.
[18:57:19] <cheeser> personally, i'd go with my 2nd fAM suggestion above
[18:57:46] <cheeser> it'd be 2 operations on the first login but only one after
[18:57:55] <akoustik> sometimes i'm lazy enough i would rather defend my bad decisions than fix them.