[00:26:19] <NaN> can I do a push to a value that doesn't exist jet? I mean, it is like upsert or something?
[00:34:09] <NaN> ...my fault, the value was and obj
[00:55:05] <george2> I currently have these functions http://paste.chakra-project.org/6322/ saved to my db.system.js. Can anyone help me figure out how I should run them over my dataset http://pastebin.kde.org/pc163fbcb/08004631/raw ?
[00:55:05] <george2> I want to collect all the posts matching userID "X" and put them through gyration() to get a radius of gyration measurement for each individual user. (pseudocode -> http://pastebin.kde.org/pa6a1e057 )
[00:55:05] <george2> The "frequency" mentioned in the JS is the number of data points for the user at location (lat, long)
[00:55:05] <george2> I'm unsure whether I need to do something with map/reduce (which I haven't used before), or if I can just use an aggregation pileline, or if I need to do something entirely different.
[00:55:05] <george2> If it matters, I will be running this over a few hundred million data points, with probably a hew hundred thousand unique userIDs.
[00:55:06] <george2> I don't want to spend hours on this only to realize I'm going about it completely wrong, so if somebody could point me in the right direction, I'd appreciate it. :)
[02:01:00] <Hyperking> How would i go about updating a key in my collection using the mongo shell?
[02:01:44] <Hyperking> I need to update posts with a pubdate: to published_date
[02:19:31] <Logicgate> how would one select a random record efficiently?
[02:21:34] <jamiel> Hi all, db.serverStatus() is reporting 65 open connections. Could anyone recommend a way to debug where these are coming from? Currently there is little to no utilisation on my application, although I do have replication enabled to a single secondary node.
[02:33:27] <george2> a has the correct data. but that's going to be a lot of information to store in a temp variable
[02:42:46] <sheki> i am trying to insert data into a mongodb and Update the object using another connection in quick succession,
[02:42:56] <sheki> the update returns with "not-found" error
[02:43:05] <sheki> is there a simple explanation for this?
[02:57:30] <Hyperking> I have a key with a ISODate() value and need to update my collection to show a different key. How would you call a method new Date() within the update method?
[03:04:18] <NaN> is there a way to exclude sub-document values with a condition?
[03:04:50] <cheeser> you can compare docs to each other. but they have to be a total match
[03:08:42] <NaN> and the compare will give me the exluded values? I don't get it
[03:09:31] <cheeser> oh, you want to exclude from the results not exculde docs with those subdocs.
[03:09:57] <NaN> yes, from the result... from find()
[03:10:16] <cheeser> no, i don't think you can do that
[03:10:31] <NaN> then I need to 'recreate' the entire object
[03:11:17] <NaN> or at least, filter with some array functions to 'clean it'
[04:17:00] <Secretmapper> hi guys I have a data modeling question
[04:17:44] <Secretmapper> I have a user collection that has assets
[04:18:02] <Secretmapper> every assets is a new object that has many properties
[04:52:11] <Hyperking> Any way to grab data from one collection to create another? I want to generate a menu that takes posts with post_type: "page" and add them into a insert for a new collection.
[04:52:37] <cheeser> it helps to think of what you'd *normally* want to fetch when getting, e.g., that user
[04:53:14] <cheeser> if you normally wouldn't want all those assets every time you loaded a user, it's usually best to store them separately and reference the user from each asset
[09:19:00] <ollivera> Do I need any special configuration with GridFS?
[09:32:28] <ncls> ollivera: no, it should work out of the box
[09:36:22] <ollivera> ncls, thank you. Are you familiar with pymongo?
[09:39:31] <ollivera> ncls, I had problems with pymongo but I managed to insert a file with mongofiles
[09:50:02] <ncls> ollivera: no sorry, I don't use MongoDB with Python
[09:58:05] <NyB> How would I go about testing my Java BSONDecoder implementation? Are there any MongoDB database dumps somewhere that would exercise all corner cases?
[09:58:48] <ollivera> ncls, it is fine. mongofiles worked to me ...
[09:59:23] <ollivera> ncls, would it be possible to define paths? it seems that I always insert in the same location
[10:02:29] <ncls> ollivera: no, I don't think it's possible, it's not like a tree
[10:04:07] <ncls> you might put a file on the "name" field like { "name": "/my/file/path/name.ext" }
[10:05:28] <ncls> it's not "name", it's "filename"
[10:06:03] <ncls> but all the records are stored at the same "root level"
[10:08:18] <ollivera> ncls, ok .. so I can use that "path" in the URL? Do you server the files with Apache or NGinx?
[10:18:35] <ncls> ollivera: yes, if you want, but remember that this is not an OS file system : there are no "read / write" permissions on it, you can only emulate the tree and the permissions with your application. You might want to store additional informations (owner, permissions, filetype, size, etc) in a "file_infos" Collection for example
[10:19:58] <ncls> No I didn't use Apache nor NGinx, but it doesn't matter : Apache will serve script files (php or python) that can handle the GridFS and render the file with the right "content type" I think
[10:26:44] <ollivera> ncls, what happens when we remove a file? Is it like GlusterFs? will it trigger a synchronization?
[10:27:40] <ncls> ollivera: I don't know because I never used MongoDB with synchronised databases on different servers, but I think that yes, it has the same behaviour as "normal" collections
[10:28:01] <ncls> you might want a more informed source confirmation though
[11:11:04] <arount> hi here (we are speaking english here right ?)
[11:12:44] <arount> I have little trouble with mongoexport command, maybe someone have the explanation to my problem
[11:14:15] <arount> I'm using mongoexport command, I have a pretty big collection (92263.063MB) indexed by _id and a field report_id
[11:15:29] <arount> I whould like to export all the collection sorted by report_id, so I use a command like: mongoexport -h 127.0.0.1:27017 -d database -c collection -q '{$query: {$orderby: {report_id:-1}}' -o dumps/2014-01-28/collection.json
[11:16:04] <arount> Ooops, bad copy / paste, the real command is: mongoexport -h 127.0.0.1:27017 -d database -c collection -q '{{$orderby: {report_id:-1}}' -o dumps/2014-01-28/collection.json
[11:17:17] <arount> but I get (got ? .. arf, french and english .. a big love story) just one line
[11:18:00] <Derick> what is the item that you get then?
[11:18:50] <arount> I tried to add $query: {} to my parameter -q, or $query: {report_id:{$ne:null}} but nothing .. if I delete -q parameter all my data are exported .. I don't really understand why
[11:19:48] <arount> Derick: Fuck ... I'm stupid ! haaa, I got: { "$err" : "too much data for sort() with no index. add an index or specify a smaller limit", "code" : 10128 }
[11:20:03] <arount> .. tsss I just have no indexes on local ..
[11:20:22] <arount> thanks, I'm a little stupid boy
[11:46:24] <NyB> err... does MongoDB support UUID type 4 ?
[11:46:53] <NyB> the current stable Java driver seems to only support v3
[11:48:19] <arount> Derick: U'r right, just an error on my shell script who exec the mongoexport command, perfect, really thx
[12:07:46] <johnbenz> Hi, I need to move one of my mongo db to a new server. So I've decided to first configure the standalone mongo instance I have to a master instance. I went in the /etc/mongod.conf and uncommented master=true
[12:08:04] <johnbenz> I did a restart and then it was not working anymore
[12:08:25] <johnbenz> sudo service mongod status was ok
[12:08:49] <johnbenz> but I couldn't connect to the mongod instance anymore doing "mongo" from the command line
[12:18:23] <johnbenz> I want just to use master/slave
[12:18:49] <johnbenz> I have only a standalone server and I want to move it to a new server with the less downtime as possible
[12:19:38] <johnbenz> my idea is to first do master/slave and when everything is synchronized change the server ip in my code and set the slave =true as comment and restart
[12:19:57] <johnbenz> byalaga: does it seem the good way to do it?
[12:19:59] <byalaga> So, did you start the existing mongodb as a replicaset member? or a standalone one?
[12:42:42] <RaviTezu> and it depends on many factors.. to decide which should be a primary(master) and which is secondary(slave)
[12:43:16] <johnbenz> RaviTezu: from what I'm reading here "master/slave" is different from "replicaset" http://docs.mongodb.org/manual/core/master-slave/?pageVersion=%5B%2721%27%5D
[12:43:54] <Derick> master/slave does not do automatic failover
[12:43:59] <johnbenz> this is this kind of "master/slave" I want, I don't want to begin with replicaset as I just need to copy the database before moving it
[12:44:38] <johnbenz> Derick: It's just for some hours, or maybe less, I don't want failover as it's just copying from one db to another with less downtime as possible
[12:45:03] <Derick> I thought that for M/S you needed to shutdown the master first
[12:45:16] <Derick> for a replicaset, you do have to do that too though...
[12:45:17] <johnbenz> Derick: if I just set in /etc/mongod.conf => master = true it should do the trick for the master right?
[13:22:30] <Mmike> Hello. I have 3 boxes in replica set, and I'd like to run repair against my datadirectory (as I need to reclaim disk space). Is this ok path to take: 1) shut down one secondary. 2) run mongod --repair, 3) fire it up. When it's in sync, do next secondary. 4) When that secondary is done too, step down primary, and do him.
[15:30:28] <Kaim> I cannot go over 400update/sec in my mongodb instance
[15:30:33] <Kaim> I'm doing atomic update, not multiple
[15:30:37] <Kaim> with query on a uniq field with index
[15:30:41] <Kaim> how can I improve perf? write pb ?
[15:34:03] <cheeser> mehola: did you file a ticket on that?
[15:37:40] <mehola> cheeser: you mean on the case insensitive sorting? It was a known issue then, so no I didn't file a ticket on it
[15:39:02] <mehola> their argument was that casing is hard with UTF8...too many characters...
[15:39:59] <joannac> mehola: why don't you store your data in lower-case?
[15:40:59] <cheeser> yeah. when i've needed case-insensitive searches i just double store with one normalized to either upper or lower
[15:42:05] <mehola> cheeser: that's fine but when you think about the fact that you to store a lower cased version of any string field you may want to sort by....just seems dirty to me
[15:42:46] <cheeser> on the other hand, i solved it and got on with life.
[15:58:56] <mehola> Kaim: you may have looked at this already but I think the journaling part may be of interest to you http://docs.mongodb.org/manual/core/write-performance/
[16:06:24] <joannac> Please don't disable journalling. It's a false economy. You'll get fast writes until something goes wrong, and then you'll have corrupt data
[16:06:56] <mehola> joannac: I wasn't telling him to disable it
[17:00:32] <DevRosemberg> Does anyone know what cn be causing parts of my BasicDb Object to not save
[17:01:40] <cheeser> mongo will save what you send it...
[17:06:52] <DevRosemberg> its not saving the punishments, achievements and purchased items
[17:10:40] <cheeser> i'm all but certain it's a bug in your code. but without a test case to isolate, i really can't tell either way.
[17:27:42] <yawniek> hi! when i do a aggregation with $addToSet, is there an easy way to not get the whole set but just the length of that set in the result?
[17:33:31] <NyB> hmmm, how would I go about creating a code_w_s (JS code with scope) BSON element in mongodb? Code without scope are simple functions, but what is the scoped equivalent?
[17:33:59] <NyB> I code_w_s are the last thing that I have to test in my BSON decode implementation :-)
[17:35:27] <Nodex> [17:08:20] <cheeser> i'm all but certain it's a bug in your code. but without a test case to isolate, i really can't tell either way.
[17:45:35] <Nodex> a case where you give MINIMAL code to see if your program works or not
[17:49:25] <Nodex> Not quite sure how a programmer does not know what a test case is
[17:58:51] <NyB> Where are code elements with scope used in MongoDB? I am trying to figure out how to have one returned within a BSON document so that I can test my decoder implementation, but I have yet to find how to create one via the mongodb shell...
[18:14:21] <Darni> hi guys... is this the right place where to ask a pymongo (mongodb python API) question?
[18:15:42] <Darni> I'm writing a Flask based server which accesses a mongo db... from what I see at http://api.mongodb.org/python/current/api/pymongo/mongo_client.html and http://api.mongodb.org/python/current/faq.html#how-does-connection-pooling-work-in-pymongo there's some connection pooling built-in
[18:16:44] <Darni> and I understnad that if I make a global "client = MongoClient(...)", I can use it in a request and I'm not risking any race condition...
[18:17:34] <Darni> if I make a global "collection = MongoClient()['some_collection_name']", will I still get connection pooling correctly?
[18:18:27] <Darni> (my app uses a single collection, and integrates a lot of legacy code which uses that global as an API, that's the source of my question)
[18:26:43] <Darni> sorry, I messed up the example, it was "db = MongoClient()['some_db_name']"
[18:27:07] <Darni> (I meant "db" everywhere I said collection :) )
[18:27:37] <cheeser> i want to say "yes," but i'm not 100%.
[18:27:43] <cheeser> using the java driver, that'd be true.
[18:28:32] <Darni> ok, that's something... I'll try to figure out the source. Thanks cheeser
[19:08:03] <NaN> for an action-log collection on users (db.history) do you guys recommend me to use 1 document per user and append the actions to a log: key
[19:08:39] <NaN> or create a new document per action and use a the users _id as "fk"
[19:40:53] <cheeser> NaN: one entry per history item
[19:41:38] <cheeser> otherwise your documents would grow too large eventually. and with separate docs you could purge old ones via TTL indexing or move them off into an archival collecition
[20:20:49] <swak> So say if I'm doing a db where it contains profile info on a user that they can keep adding to. Should I make a new page for each addition?
[20:22:50] <swak> one is use an array in the page for each addition or to create a new page for each addition using ids from a central location.
[20:24:16] <swak> I'm just wondering how much I should break things apart.
[20:37:11] <swak> So say if I'm doing a user profile in which the user can keep adding info. I'm planning on separating different categories into different collections. However, should I store everything for a category for a user into one page using an array or should I store an id in an array pointing to each addition?
[20:41:57] <NaN> tried to import with mongoimport but it tells me "exception:BSON representation of supplied JSON is too large"
[20:44:13] <NyB> NaN: it could also be that you are trying to upload a document larger than the maximum size allowed by MongoDB. Did the document come from MongoDB or from some other source?
[21:10:25] <kali> slyth: cursor are lazy. so it's not the conversion but the actual database access that you pay when you convert to a list
[21:10:37] <cheeser> i'm not a c# guy (though I can mostly read it) but it's virtually impossible to diagnose speed issues without any details. show your code?
[21:10:48] <cheeser> might be an indexing issue, e.g.
[22:12:58] <bloudermilk> Just wrote a mapReduce to calculate popularity scores for one of my collections (groups) based on another collection (messages). The reduce is keyed on the group's _id and writes to a "ranked_groups" collection. What is the idiomatic way to query "groups" based on the score field in "ranked_groups"?
[23:28:30] <brendan6> Does anyone know if there is a way to create an index so that that the query db.collection.find({'foo.0.bar': 1}) uses an index for a document {foo: [{bar: 1},{bar: 2}]}?
[23:29:09] <brendan6> db.collection.ensureIndex({'foo.bar': 1}) only uses the index with a find like db.collection.find({'foo.bar': 1})
[23:34:03] <thesheff17> can you do an update on a collection with $gte and $lte for a range of integers?
[23:34:10] <thesheff17> or do I have to do a find and then loop through them?
[23:37:22] <pgora2013> thesheff17: not sure if this is what you are looking for : {multi: true} as the third parameter
[23:39:33] <thesheff17> pgora2013: this is basically what I have in python http://pastebin.com/wax2VJJy