[01:26:34] <garthkerr> W: Failed to fetch http://repo.mongodb.org/apt/ubuntu/dists/trusty/mongodb-org/3.0/multiverse/binary-amd64/Packages 404 Not Found
[01:26:46] <garthkerr> It seems to have moved under /testing/
[02:35:07] <MLM> I want to implement an ordered list. I have a model with an integer `order` field. What would be the best way to update each successive row/document when an item is moved around?
[02:37:27] <GothAlice> MLM: https://gist.github.com/amcgregor/4361bbd8f16d80a44387 < a full taxonomy model mix-in (Python, but demonstrative)
[02:38:41] <GothAlice> Most append/prepend after/before calls come down to a call to insert, here. There's maths. And likely race conditions. And it's not optimized for the case of moving something within a set of siblings.
[02:44:45] <MLM> Looks like some people did make wrappers: https://www.npmjs.com/package/mongodb-promises, https://www.npmjs.com/package/mongodb-promise
[02:47:51] <MLM> Ye, I don't see any difference in API to Mongoose so why not. Plus promises are awessome and this package seems pretty up to date: https://www.npmjs.com/package/mongodb-promises
[02:49:36] <MLM> Should I add a bool to items to add a lock to address race conditions?
[02:52:37] <GothAlice> That could help, as long as you have a sane retry and failure policy in the event of a long-term conflict.
[02:52:56] <GothAlice> Backup plans for backup plans, there. ;)
[02:56:08] <MLM> hmm, If you have any good articles on the retry/failure topic, I'm interested
[02:58:49] <GothAlice> Often things like this may require background processing, often on a schedule. https://gist.github.com/amcgregor/4207375 is a model for this, including sample code, sadly in Python. :)
[02:59:07] <GothAlice> (Document samples, though, are pure MongoDB.)
[02:59:17] <MLM> Ye I have read a bit about the job queue problem with databases. This is just a ordered list that I want to make
[02:59:57] <MLM> No processing but I could see a conflict if multiple requests are made to reorder the same list. Order indexes could get jumbled
[03:01:46] <GothAlice> You effectively need to two-phase a $inc for a range of documents (siblings after the insertion point) and a $set of the document into its position.
[03:03:20] <GothAlice> With a unique key on (parent, sequence_no) or such. In the event the $set fails, roll back the "transaction" ($inc: -1 things back). Mid-"transaction" here the sort order will be otherwise unaffected.
[03:04:54] <MLM> Would it be wise to use the latest request to re-order? And of course debounce to every second or so if a constant stream of re-ordering requesting are made?
[03:05:45] <MLM> nevermind because the re-ordering is only per item. not bulk movement
[03:07:37] <GothAlice> There are also subtleties to how you count records when inserting with offsets from the "bottom" of the list instead of "top".
[03:09:22] <MLM> I think I will just allow a user to set a new order index of an item by id. Then just update/shove the other items of the list into place.
[03:11:23] <GothAlice> I have pretty drag-and-drop re-ordering in my MongoDB CMS that uses this type of arrangement, with an API of alterChildIndex(oldIndex, newIndex).
[03:12:22] <GothAlice> I'll be moving to the taxonomy API I linked above for a more nuanced approach, once I armour it against and verify race conditions, in the above way. ;)
[03:19:12] <GothAlice> It's more of a defensive coding practice. I'll see if I can dig up some links.
[03:19:20] <GothAlice> Er, that was a wrong window!
[03:21:05] <MLM> In Mongoose you define Model Schemas. Since I believe Mongodb is loose with its fields, there is no enforcement there right?
[03:21:32] <MLM> (no enforcement with the raw driver) to get back a certain object shape with properties and defaults if non-existent
[03:56:32] <GothAlice> MLM: Your first set of statements is correct.
[03:57:03] <GothAlice> During certain operations, one could in theory provide default values if extant values do not exist, such as during an aggregate query $project operation.
[04:09:31] <Freman> I know that the second one succeeded because of where they are and what the error message is set to on callback
[04:09:54] <Freman> $pushes only happen on append, the first $set is 'save'
[04:11:51] <Freman> http://pastebin.com/gA4EcN1A i s the final document
[04:14:11] <Freman> psudo code for the task looks like function startlog() {mongo.update(..., function(err) {'Problem saving log'})}; function appendlog() {mongo.update(..., function(err) {'problem appending log'})};
[04:14:35] <Freman> they're both being called about 100 ms apart but the second call is the one that succeeds becuase it's the first one that complains
[04:23:19] <Freman> there is no mention of T8WA3j9EE2ESzN53PzH7 in the log
[04:25:10] <Freman> nothing that spits Problem saving log MongoError: E11000 duplicate key error index: logsearch.log_outputs.$_id_ dup key: { : "T8WB63bTLGwQwdAnk68f" } out shows up in the log
[09:59:10] <aslomowski> i would like to truncat it
[09:59:23] <aslomowski> its subdocument in schema ;p
[10:03:05] <morenoh149> aslomowski: if `schema` on 7 were the schema of timeTableSubSchema then it should have the hour, minutes and type fields as well no?
[10:03:31] <flusive> GothAlice, http://picpaste.com/htop-YLxZbetZ.png do you think is still ok?
[10:03:35] <morenoh149> there are two object's in that paste. What are they?
[10:45:21] <brano543> Hello, i would like to use an external index library with mongo. Can you tell me how am i supposed to do it? Just store the id in both places,in the library and in mongo?
[10:47:03] <brano543> The library i want to use is libspatialindex, right now i am able to insert into the index, but i would like to use mongo as the database backend for this index.
[10:48:25] <rymate1234> noob question - I have a mongodb collection with a date field - example field is "date" : ISODate("2015-02-27T10:40:14.962Z"). How would I query the database to get items from the last hour?
[10:50:09] <brano543> rymate1234: as far as i know, mongo is object database, you can´t just use functions like in relational databases. i guess you will need to "explode" that date into separate fields.
[10:50:43] <obeardly> brano543: your question makes no sense, MongoDB if fairly optimized for what it does, why screw with it? My only suggestion if you are looking for key/value store, and nothing else, you could look at AeroSpike, but AFAIK as a DB, you can't beat defacto MongoDB
[10:51:56] <brano543> obeardly: maybe you misunderstood me. i don´t want to replace mongoDB. i just need to use the r-tree spatial index from libspatialindex.
[10:52:44] <obeardly> brano543: quite possible, I'm at the end of my day, I'll reread
[10:53:50] <brano543> obereadly: You said MongoDB is optimized,i hope so, because i want to create edge-exapanded graph representations and use it for routing
[10:54:40] <brano543> obereadly: i mean each document will have list of neighbours with their cost values.
[10:55:17] <obeardly> brano543: My best guess, if if your question exceeds the basis of MongoDB capability, it's beyond my ability; I do know that MongoDB has the ability to use C libraries, but it's beyond my expertise, apologies for speaking out of line
[10:56:40] <Tobatsu> Hi. One question.. I've been told that MongoDB is somehow based on Hadoop. Is that correct information?
[10:56:55] <brano543> obereadly: i just asked for curiosity, it would be great to serve spatial queries. For my purpose right now,i will just do with using the R* tree library temporary to preprocess the data and insert into mongoDB.
[10:57:33] <obeardly> rymate1234: your question is a little out of my wheelhouse, but I found this:
[10:58:04] <rymate1234> huh, that doesn't look too hard
[10:58:12] <rymate1234> just need to figure out how to do the same with python
[10:58:17] <obeardly> Tobatsu: you're comparing Hummers vs Passenger cars
[10:59:03] <Tobatsu> obeardly: So I thought too but I just wanted to be sure. :)
[10:59:16] <brano543> is here someone who can tell me how to use external index library libspatialindex with mongoDB? :)
[10:59:34] <obeardly> Tobatsu: think of Hadoop as a Hummer, it can carry a lot of data, but it's kind of slow, where passenger cars carry a smaller payload, but are much faster
[10:59:40] <brano543> there is really lack of information about something like this
[11:00:11] <obeardly> brano543: again, sorry I can't help you
[11:01:46] <obeardly> Be easy my friends, true happiness lies within ones self, and not their existentialism
[11:07:19] <brano543> If anyone knows someone who might be able to help me with using external spatial library libspatialindex with MongoDB or clarify me the concept how it may work,please let me know, i will stay on the channel :)
[11:20:51] <jsfull> hi guys, everyday my crawler collects a list of top 20 urls from google for particular keyword, the results change often and what i want to find out is how volatile the result is for today, so my question is, how do i calculate the volatility/change %, wondering what math equation i should use- input on this would be really helpful
[11:47:34] <zivix> jsfull: I think that largely depends on your definition of "volatility". But as a starting point I'd use the rank delta as a measure, and you can create a scale from less to more volatile based on how often the rank changes or how big that change is. Overall volatility would be a function of those two datapoints over time, imo.
[11:48:31] <brano543> If anyone knows someone who might be able to help me with using external spatial library libspatialindex with MongoDB or clarify me the concept how it may work,please let me know, i will stay on the channel :)
[12:06:28] <d0x> Hi, is there a way to get the calendarweek of a date in mapreduce?
[12:06:44] <d0x> Or do i need to calculate it myself?
[12:08:38] <d0x> in the aggregation framework there is the $week option for that
[12:25:50] <brano543> If anyone knows someone who might be able to help me with using external spatial library libspatialindex with MongoDB or clarify me the concept how it may work,please let me know, i will stay on the channel :)
[12:38:51] <jsfull> thanks zivix, good point - will give that a try :-)
[13:01:15] <brano543> If anyone knows someone who might be able to help me with using external spatial library libspatialindex with MongoDB or clarify me the concept how it may work,please let me know, i will stay on the channel :)
[13:36:14] <brano543> aliasc: official documentation says 16 MB,you should read it, if you want bigger you need something called GridFS
[13:36:21] <brano543> If anyone knows someone who might be able to help me with using external spatial library libspatialindex with MongoDB or clarify me the concept how it may work,please let me know, i will stay on the channel :)
[13:37:01] <aliasc> what happens if the limit is exceeded
[13:37:17] <aliasc> i can't ask the documentation what i want to know :) so thats why i'm here
[13:37:34] <StephenLynx> probably it throws an error if you try to add stuff that exceeds this limit.
[13:38:04] <brano543> StephenLynx: Hello, can you help me with my issue of using libspatialindex as secondary index to MongoDB. what are the practices?
[13:38:18] <StephenLynx> i don't even know what is a spatial index :v
[13:38:38] <aliasc> probably. hm we are talking about valuable data here, i can't rely on probably
[13:39:12] <brano543> StephenLynx: it is a tree where you can store geographical coordinates and they are grouped according to the Minimum-bounding-rectangle approximation of each area.
[13:39:13] <StephenLynx> make text out of files and keep adding it to a document
[13:39:27] <aliasc> currently i structured my data like in RDMBs model with ids linking to documents but thats not what mongodb is right
[13:39:30] <d0x> Is there a way to call db.xxx.find(...) inside a map function of an Map Reduce task?
[13:41:47] <StephenLynx> and I keep embedded stuff that I am sure that won't grow too large.
[13:42:14] <brano543> StephenLynx: Nevermind,you may be able to answer me second question. I want to store adjacency list in MongoDB where each record contains neighbor ids and travel costs. Is it a good idea to let mongodb actually query the DB like this and find a route by known algorithms or is it slow?
[13:42:22] <StephenLynx> for example. I make a separate collection for threads in a forum and posts in a thread. but I keep embedded the list of mods for the forum.
[13:42:28] <aliasc> exactly. and the thing i love is i program classes the way i want my collection to be and just insert the object of the class
[13:44:04] <brano543> StephenLynx: I looked into that,but i need my own route algorithm,i am doign a specific task :)
[13:44:32] <StephenLynx> yeah, I have zero experience with that. what I know is that mongo does not have any tool to relate objects and collections.
[13:44:54] <StephenLynx> so if your work relies intensively into these relations, you should probably not use mongo.
[13:46:13] <brano543> StephenLynx: I asked about the MongoDB performance. i can make those relations,thats not problem for me,adjacency list should do it. So you suggest using mongo as temporal storage,then load the graph into main memory server and run the routing algorithms there?
[13:46:47] <StephenLynx> I suggest using a graph database in the first place.
[13:47:02] <StephenLynx> because I found out yesterday they exist.
[13:47:24] <StephenLynx> mongo performance is good for reading and writing documents, that I know, though.
[13:47:39] <StephenLynx> and it can handle large volumes.
[13:48:09] <StephenLynx> but the thing is, these routing operations would have to be performed by your application
[13:48:55] <StephenLynx> if you use a graph database you will have these operations done in a tool specialized for that and at the same time your application will not have to perform any actions in this regard.
[13:49:07] <brano543> StephenLynx: i asked this school,if they could send me a paper what were they actually doign last year,but they didnt reply me http://cs.brown.edu/research/pubs/theses/capstones/2014/chen.andersen.pdf
[13:49:48] <StephenLynx> so even if mongo's raw performance is higher than this database, your operation total performance might be lower because you will be doing two jobs for a single operation if you use mongo for it.
[13:49:58] <brano543> StephenLynx: well, as fas as i know,there isn´t a graph database where i can specify my own traversal,at least its very hard, i have to nderstand Java which i don´t know.
[13:53:16] <brano543> StephenLynx: I understand, but i do it as my bachelor thesis and i even got asked by some bus travel company that they are interested in my product :)
[13:56:11] <brano543> StephenLynx: In those graph databases there are already implemented functions for shortest path which i don´t need. I can create as simple thing as graph representation myself. The point thing of database is that it keeps persistance of data and can handle many clients. I also looked at project Openstretmap Routing Machine and i am not sure how tehy server is implemented,the code is really huge
[13:57:28] <StephenLynx> so the problem is that you need to implement a custom logic for the paths and you believe these graph databases don't allow you to?
[13:58:30] <brano543> StephenLynx: My problem is i am not sure how to deal with creating multithreaded server to use my custom program to handle queries.
[13:59:16] <StephenLynx> so the problem is with the server that will be handling the http requests?
[14:00:00] <StephenLynx> if you have to handle many concurrent requests, I suggest io.js.
[14:00:16] <StephenLynx> if your application is CPU intensive, Go.
[14:00:55] <GothAlice> I recommend Python, of course. ;)
[14:00:58] <StephenLynx> io.js deals with concurrency by having a thread per CPU core, so if you perform cpu intensive operations, it will not be really good.
[14:03:37] <brano543> StephenLynx: okay guys, listen, lets not waste time, i will try to use mongodb for routing and if that doesn´t work out i will create in-memory representation of graph,lets say use STXXL:map for storing it, then find the path using custom traversal and get additional information about nodes from MongoDB when the route is finished. That is also a way.
[14:04:50] <Cygn> Hey guys, how to handle big insert requests in mongo db?
[14:05:16] <Cygn> Is there a way to import something equivalent like an .sql file in MySql?
[14:05:30] <Folkol> Yes, you can export and import data-.
[14:06:06] <brano543> StephenLynx: i will let you know in few days how i proceed, right now i am solving approximation of points using Boost:envelope minimum bounding rectangle :)
[14:06:06] <GothAlice> See also mongodump/mongorestore. These read and write MongoDB BSON files, mongoimport/export handle other, simpler formats like CSV.
[14:06:33] <Cygn> I already wrote it in mongo language so mongorestore could be the right way, thanks guys !
[14:07:38] <GothAlice> StephenLynx: Even our data disagree. https://gist.github.com/amcgregor/707936#file-terminal-3-top — in the middle of processing 10,000 concurrent requests memory usage is ~10MB. (This is without threading. Threading adds ~2-4MB.)
[14:08:29] <brano543> StephenLynx: Have a nice day.
[14:10:37] <Cygn> Another Question guys, i had to use the Date() Function of mongo, thats why i wrote my whole import as mongodb request (db.collection.insert …) can i also import this statement as a file?
[14:11:32] <GothAlice> Cygn: Yes. I don't recall MongoDB's preferred date format for import, but you could find out by exporting some data involving dates first, then having a gander. :)
[14:12:09] <Cygn> GothAlice: Yeah, my problem is i did that and it exports .bson which is not readable :/
[14:12:36] <GothAlice> That's a dump, not an export. Try the "mongoexport" tool instead, and make sure to select a format like JSON, or CSV (if appropriate).
[14:17:06] <Cygn> GothAlice: It exports like { "$date" : "2014-01-04T00:00:00.000+0000" } … but that is my problem, my importdata has a datestring "2014-01-04" which i want to have imported using the Date() Funciton (which i could do in a normal mongo statement.
[14:17:55] <GothAlice> Yeah, that won't work. Data != code. You'll need to reformat those dates in the proper ISO format, wrapped in {$date: } to mark it as such.
[14:18:00] <d0x> Is there a way to see all methods of an array in mongodb?
[14:38:35] <StephenLynx> Considering how fast a hash function can be, I don't think it would have a severe impact.
[14:43:31] <StephenLynx> GothAlice that benchmark means little. First, I don't know what code is running behind the test. Second it does not compares to anything. Third I don't know the hardware. Fourth, I don't know how much your server software deviates from the standard python webserver.
[14:49:15] <nir> I have the following collection http://pastecode.org/index.php/view/1ce4d941, and I don't know how to write my query to find all products that have a specific set of "filters"
[14:51:33] <nir> i also try to find products that have a specific filter but that is not working : db.products.find( {"filters": {$elemMatch: {"identifier": "HOM"} }})
[14:52:44] <Cygn> I want to use the Value of a field inside a foreach, i know that i can pass it f.e. via ….forEach(function(e) { e.value } - but what to do if my column name is "1" ?
[14:53:04] <StephenLynx> nir elemmatch is used to get stuff from subarrays
[14:53:17] <StephenLynx> for your query to work, filters would have to be an array
[14:54:12] <StephenLynx> does your filter's sub-documents must have a field? it looks redundant having the "identifier" field
[14:54:30] <Cygn> If i try f.e. e.6 i get "unexpected number" if i try e."6" i get "unexpected String" :(
[14:54:32] <StephenLynx> instead of assigning the value of identifier directly to "sex" or category"
[14:55:32] <StephenLynx> anyway, you can just use dot notation
[15:01:51] <StephenLynx> nir how is the search logic suposed to work?
[15:02:16] <StephenLynx> since you don't know which field must match which value?
[15:22:23] <sweb> some one help :( http://paste.ubuntu.com/10450136/
[15:24:17] <StephenLynx> you must first query to filter the results with a $match block and then use an acumulator operator, like push
[15:24:31] <StephenLynx> grouping in mongo doesn't do stuff automatically.
[15:24:56] <StephenLynx> take a look at their examples.
[15:28:36] <StephenLynx> the group block works similarly to the projection block, you give it a field and something to put in the field. except it can take accumulator operators , it required an _id on documents, and can't take booleans to just project or not the field.
[15:35:38] <Cygn> I use a collection called dataChunk, which has a column with the identifier "5", i need it to be 5, i wanted to do it that way: db.dataChunk.update({}, { $rename: { '"5"' : '5' } }), which does not adress the column "5" apparently, any suggestions?
[15:45:48] <Cygn> My Problem is i have a whole bunch of date values, that i need to push through the mongo Date() Function in the end. I don't care if i import them using csv, json etc. but after the import i need to address them in any way inside a foreach loop to push them through that function.
[15:46:36] <StephenLynx> do a regular find and show me the results
[15:46:48] <GothAlice> Interesting, JSON parses {"27": 42} fine, but a JS shell doesn't.
[15:49:48] <FunnyLookinHat> Is there a way to take my administration user and grant it access to every db in the system ? Or do I have to manually create it for each database?
[15:50:11] <StephenLynx> GothAlice is any benefit in doing that instead of using the plus sign?
[15:50:55] <GothAlice> FunnyLookinHat: There are some roles that give server-wide permissions. I.e. readWriteAnyDatabase, userAdminAnyDatabase, dbAdminAnyDatabase.
[15:52:45] <GothAlice> StephenLynx: Obviousness, less likely to run into accidental addition (instead of unary plus casting), etc. Basically, using the functional instead of fancy approach is less likely to bite in exotic ways.
[15:53:26] <GothAlice> (Just remember to always supply a radix. 'Cause that's another gotcha.
[15:53:49] <FunnyLookinHat> GothAlice, when I try to update with a new set of permissions, it seems to automatically apply them to only a single database though? http://hastebin.com/ujaqufipaf.profile
[15:54:29] <GothAlice> FunnyLookinHat: User maintenance happens in the "active" database. Is your "admin" database active, or one of your target databases?
[15:59:13] <Cygn> StephenLynx, GothAlice: i really try to get on track here, and solve the problem i have in any possible way, but … right now it would most likely fix everything if i could just at least adress the value inside my forEach statement, which seems impossible since i can neither write function(e) { e."4" } / function(e) {e.4} to adress it
[16:07:21] <Cygn> StephenLynx: The stringify result: http://pastebin.com/bYb309nj - to your other feedback, does that mean i can't use the foreach to the find function?
[16:07:38] <StephenLynx> you can, you can't use the way you are trying
[16:08:14] <Cygn> StephenLynx: Was actually based on a very high ranked StackOverflow Example… http://stackoverflow.com/questions/3788256/mongodb-updating-documents-using-data-from-the-same-document/3792958#3792958
[16:08:38] <GothAlice> … this data is flat, uses pseudo-numeric field names, and ignores native datatypes for integer and date values. Cygn: Your data fits a relational model far better than MongoDB.
[16:08:46] <StephenLynx> you are using javascript, aren't you?
[16:08:58] <Cygn> StephenLynx: i am using the mongodb console
[16:09:08] <StephenLynx> nevermind what I said then.
[16:09:23] <StephenLynx> it was in the context of javascript.
[16:09:49] <StephenLynx> can't see why you are so concerned then, what you do on CLI is barely valid on any language.
[16:09:54] <StephenLynx> aside from the logic, of course.
[16:10:43] <Cygn> StephenLynx: Concerned? I just need to transform the date fields, and i can't since i get a syntax error all the time.
[16:10:59] <GothAlice> Hmm, that SO post makes me want to try a $rename that moves a field into a non-extant new sub-document to see what would happen.
[16:11:34] <StephenLynx> Cygn but are you just doing that once on your CLI?
[16:11:47] <Cygn> StephenLynx: exactly just because my import data is malformed
[16:11:47] <StephenLynx> and you said you wanted to rename from a string to a number, but you can't do that.
[16:12:01] <StephenLynx> a field name will always be a string.
[16:12:12] <GothAlice> Ignoring the fact that console doesn't exist in the MongoDB shell, http://cl.ly/image/2c0h1B1w0N0z < totally works
[16:13:22] <GothAlice> Sounds like what you're pining for, though, is mysql_fetch_array. :/
[16:13:23] <StephenLynx> HAHA indeed, if the field name can be parsed to a number, you won't be able to reference it in dot notation
[16:13:53] <GothAlice> StephenLynx: The trick seems to be the first character being numeric. If it's alpha instead, the extra digits don't matter.
[16:14:31] <StephenLynx> omg, true. tried to do foor.5x and it didn't worked either :v
[16:14:45] <StephenLynx> js inconsistencies are hilarious.
[16:18:00] <GothAlice> Well, it's just the identifier naming convention. [a-zA-Z_][a-zA-Z0-9_]* — that's a pretty common pattern, same as Python's actually.
[16:18:03] <Cygn> GothAlice: This just worked… i don't get really why but it did...
[16:22:50] <Cygn> Thank you both very much for now… especially for the answers to the confused questions.
[16:25:56] <StephenLynx> the field names are awful, imo.
[16:25:58] <GothAlice> … this data is flat, uses pseudo-numeric field names, and ignores native datatypes for integer and date values. Cygn: Your data fits a relational model far better than MongoDB.
[16:26:53] <GothAlice> mysql_fetch_array — get back the record as an array, with actual numeric separation, in PHP-land, at least.
[16:27:40] <GothAlice> "6" is meaningless. "created" has meaning, as an example.
[16:27:50] <Cygn> GothAlice: I need to have the functionality to add columns without having a fixed data structure, the data will in addition never be fetched, it will just be counted using the columns as criteria. I could only use postgres and the json functionality.
[16:28:36] <StephenLynx> Cygn and why you have to use numbers to that?
[16:28:51] <GothAlice> Cygn: MongoDB already lets you add arbitrary fields, and have those fields differ between documents in the same collection (though do this with an appropriate dose of caution). Nothing you've described suggests to me a numeric field name approach.
[16:29:04] <StephenLynx> if its a list of aditional anonymous data, you can just have a subarray and throw them there.
[16:30:45] <Cygn> StephenLynx: actually this is just an idenitifier used by the infracstructure of the whole company workflow. Each Sale has some attributes, all atrributes have an id which identifies them. In the whole system 1 means the market for example.
[16:31:00] <GothAlice> Cygn: Also a candidate for EAV (entity attribute value) storage.
[16:31:23] <StephenLynx> yeah, you can just have a subarray in the document that represents the sale and throw this data there.
[16:31:58] <Cygn> Stephenlynx: you mean each entry should be a subarray? (i really try to get what you want to tell me ;) )
[16:32:19] <StephenLynx> no, each entry is a value in a subarray of the sale.
[16:33:34] <StephenLynx> can't you REALLY name the fields, btw?
[16:33:49] <StephenLynx> the whole thing is meaningless and a code hell
[16:34:34] <StephenLynx> if you know which index represents which data, can't you use words instead of the position?
[16:34:53] <Cygn> StephenLynx: (using this value as id would be wrong since this is not the id)… but yes i could just make up names by myself for each column and associate the input data
[16:35:07] <Cygn> StephenLynx: it's not even distinct, that's what i mean.
[16:39:02] <agenteo> hi there, I remember querying a string field for its size but I can’t find how anymore… does anybody know how?
[16:43:19] <Cygn> StephenLynx: I mean i could just use only data: subarray as value, but where would be the improvement?
[16:43:40] <StephenLynx> don't you have anonymous data?
[16:44:51] <agenteo> never mind db.content_pieces.find( { $where: "this._id.length = 36" }
[16:46:39] <pamp> hi guys, its possible match a document when the difference for the others is that this one have an array field?
[16:47:13] <pamp> like {_id:123, a[2,3]} {_id, a:34}
[16:47:25] <pamp> i want to match the first example
[16:47:42] <pamp> some documents will be matched in millions
[16:48:36] <agenteo> I have now a more interesting question, can I check if a field is an ObjectId?
[16:55:54] <Cygn> StephenLynx: i do - if i get right what that acutally means
[16:56:17] <StephenLynx> if its anonymous you don't need a field name.
[16:56:35] <StephenLynx> just throw in a subarray and put the other data in named fields.
[16:56:56] <Cygn> i need it, the numbers are not random at all.
[16:58:23] <GothAlice> agenteo: Be aware that it interacts with arrays in somewhat odd ways. (I.e. if the field being checked for ObjectId-ness is an array containing at least one ObjectId, it'll match, too.)
[16:58:47] <agenteo> I see thanks for the gotcha, I am lucky enough to check for a single field
[17:00:34] <StephenLynx> if they are not random, then its not anonymous
[17:00:46] <StephenLynx> if they are not anonymous, don't use a number, use a word.
[17:06:23] <Cygn> StephenLynx: Okay, you're actually right i will change this afterwards.
[17:07:34] <Waheedi> What is this about? rollback 2 FindCommonPoint
[17:07:43] <Waheedi> after rollback state it becomes fatal
[17:42:22] <Waheedi> How can i recover my primary DB from a fatal states
[18:11:12] <GothAlice> Other drivers should have similar "from_datetime" methods on ObjectId to let you construct time-specific IDs for use in range queries.
[18:16:24] <GothAlice> Waheedi: Worst-case scenario in the event that your secondary safely promoted itself to a new primary: nuke the old (dead) primary and re-add it to the replica set as a new node. It'll re-replicate, join the set, then you can force an election if you care which node is primary.
[18:17:21] <GothAlice> (For reliability one should not require a certain node be primary for anything other than logistic reasons, i.e. to keep it in the same datacenter.)
[18:18:02] <Waheedi> GothAlice: the secondary got elected for primary, i don't really care which one is primary. The thing is the fatal state node is almost one month ahead of the current secondary (elected to primary node)
[18:20:00] <GothAlice> Hmm. Well, on the currently dead former primary you're going to want 2.1x the free space available on-disk than your data currently consumes, at a minimum, then try running mongod in --repair mode.
[18:21:02] <Waheedi> anyway without using the repair GothAlice?
[18:21:10] <Waheedi> its going to take couple of days
[18:21:27] <Waheedi> or 36 hours to be more precise
[18:21:38] <GothAlice> Waheedi: Yeah. "Do you have backups" means "we can't fix this". It may be time to start digging out the tape archives. ;) --repair is worth a shot (given the free space available to do it) but no guarantee in the situation you're in, with things in such a wonky state. Make a note, BTW, to add better monitoring of your system to catch things like growing replication lag in the future.
[18:25:59] <GothAlice> While technically it shouldn't really hurt to nuke that from disk, you may have hanging associations within the MongoDB configuration or remaining dataset, so it's best to avoid tampering.
[18:26:09] <GothAlice> I.e. make a shapshot backup before --repair'ing, too.
[18:26:27] <GothAlice> Worst-case you _may_ be able to mongodump directly from the on-disk files.
[18:26:42] <GothAlice> --repair effectively dumps then restores.
[18:26:51] <GothAlice> (thus needing the free space.)
[18:27:08] <Waheedi> yeah its a cloud storage mounted to the device
[18:27:41] <Waheedi> block storage/ pretty fast though
[18:27:43] <GothAlice> Hmm. Haven't tried using Rackspace's block volumes yet.
[18:28:57] <Waheedi> What about the oplog.rs if i deleted it would it sync again with the replica set? if i re add this dead node?
[18:29:53] <GothAlice> Same comment from before: you may lose some important association which may cause the --repair to bail or other problems. In theory it's disposable.
[18:30:35] <GothAlice> You've run into a split-brain problem, though. You have a dead primary newer than the current primary… is new data still being added?
[18:31:24] <Waheedi> i stopped new data from getting in temporary
[18:31:53] <Waheedi> i configured my apps to talk with the single dead node
[18:32:03] <Waheedi> and they are functioning well
[20:17:56] <Waheedi> GothAlice: Can i share what i'm planning to do?
[20:23:16] <voidDotClass> Am I doing something wrong here with how i'm using the java driver: https://gist.github.com/anonymous/ec0a3e84cedc68ccfa9d
[20:23:57] <voidDotClass> everything works upto the last one, where i do cursor.size(), it dies with the exception: com.mongodb.MongoTimeoutException: Timed out after 10000 ms while waiting to connect. Client view of cluster state is {type=Unknown, servers=[{address=127.0.0.1:27017, type=Unknown, state=Connecting, exception={com.mongodb.MongoException$Network: Exception opening the socket}, caused by {java.net.ConnectException: Connection refused}}]
[20:24:05] <voidDotClass> which is weird because i didnt' give it 127.0.0.1
[21:51:20] <voidDotClass> just saying, would've been cool if the java driver of mongo didn't act like the php / javascript driver and threw up an exception on receiving null, instead of silently converting it to 127.0.0.1
[21:51:31] <voidDotClass> provide a no arg constructor for that instead of converting null