[05:22:01] <dgaffney> can anyone explain how --repair goes through and does its job?
[05:22:12] <dgaffney> I have a big old DB that's been sitting on it for 3+ hrs
[05:22:41] <dgaffney> and I'm just wondering when the light at the tunnel will appear as the commands its running (from looking at the log) look remarkably similar from the hour before
[06:03:48] <NaN> is it possible to do an insert from a JSON file in the mongo shell?
[06:37:10] <amitev> i have a requirement to generate sequential ids and have to guarantee that there will be no records with the same id and there will be no skipped ids in the sequence
[06:37:42] <amitev> i should perform some kind of lock
[06:37:54] <amitev> is there a best practice for that with mongodb?
[07:26:28] <kali> amitev: man, no skipping ? i would not even know how to do it in SQL
[07:30:28] <amitev> kali: by locking the record in the transaction "select for update"
[07:30:54] <amitev> the other transactions will wait
[07:33:13] <kali> amitev: locking is not very mongo-ish, you'll be on your own: you can implement a mutual exclusion with atomic operators on a well known document
[07:33:59] <kali> amitev: for the "working" case, it's pretty straight-forward, but the devil is in the details and the error code path :)
[07:34:47] <_pash> is the _id parameter completely unique, or only unique in the database?
[07:36:11] <kali> _pash: mongodb will enforce its uniqueness on one collection. the rest is up to you
[07:36:47] <_pash> how do i make sure that the _id parameter is completely unique accross all my databases?
[07:37:15] <kali> if you use objectid, that's what you get
[07:38:46] <_pash> kali: if i just inserst into the database, is it completely unique?
[07:42:25] <kali> _pash: it's the generation scheme that ensure uniqueness, not the database
[07:43:40] <_pash> "MongoDB uses ObjectIds as the default value for the _id field if the _id field is not specified" so if i dont specify the _id parameter when I am passing the data, then mongo uses ObjectId(), which is completely unique. Correct? kali
[07:45:17] <Nodex> still haven't read the docs I see
[07:45:19] <_pash> kali: cool. just wanted to clarify before i would create a big mess, thanks!
[07:45:58] <_pash> Nodex: I am reading it, slowly as you see I am quoting them :) As I said, I cant read all the docs in one night.
[07:49:04] <_pash> Nodex: you might think its easy and self explanatory, but as you have said: "I have been doing this for a very very long time". Knowledge = Time and Practice
[07:52:07] <amitev> kali: i guess that i need something like this - http://docs.mongodb.org/manual/tutorial/create-an-auto-incrementing-field/
[07:53:45] <Nodex> _pash : you couldn't even be bothered to read the docs on ensureIndex last night, it explains it better than we can.
[07:54:55] <_pash> Nodex: reading and understading are two different things friend. You cant know if I have read them or not. In fact I have read them.
[07:59:43] <Nodex> I know you didn;t read it because the question you asked made NO sense if you had read it friend
[08:01:04] <kali> amitev: yeah, that will ensure uniqueness, but if for some reason (bug, crash) you can't insert the document after having consumed an int, your sequence will have hole
[08:01:10] <Nodex> exactly the same as if you had read about ObjectId's you wouldv'e known the were unique
[08:07:45] <_pash> Nodex: here is the thing, nowadays, reading docs, searching the web, etc, can give any one person an answer to any question. So then what is the point of irc i ask you? To get a real time, live reply, right? Not to get bashed when you come to ask for one. I understand I have to actually start looking at the docs before coming in here, and asking the question first. I shall start that, but it is a subconsious
[08:07:47] <_pash> decision for a search of an answer in the minimal time. Pardon me if you would.
[08:23:47] <Nodex> I am not bashing you, I am asking you to read the docs before you ask a question. Both questions i have seen you ask in 2 days are both covered in the first 5 ilnes of the respective pages in the docs.
[08:53:42] <spicewiesel> hi all, I could need some help on deploying a sharded cluster. The first step was the creation of the first replicaset, I did this with auth enabled, so my first question: Do I have to add an admin user one one/all replicaset members or do I have to add this admin user via mongos later.
[09:14:52] <spicewiesel> that's what I did, but I did it while creating the cluster, not as a change later
[09:17:58] <remonvv> spicewiesel, try it and see. I never use auth on dev or production environments.
[09:18:57] <spicewiesel> I added an admin user later, as described in the tutorial, after logging in with that user, I cannot add shards or see the sh.status. I'm not authorized
[09:21:44] <remonvv> What roles does your admin user have?
[09:27:55] <elon> Is there any way to insert a document only if it doesn't already exist, apart from find()ing the document and insert when find() returns nothing?
[09:29:12] <elon> remonv: Does that not update the document if it does exist?
[09:29:46] <elon> remonv:"The update() method can either replace the existing document with the new document or update specific fields in the existing document."
[09:30:15] <remonvv> elon: Yes, but you can either not update anything or update fields to what you know would be the correct value.
[09:30:29] <remonvv> elon: This is one of those things where it's easier to tell us what you want to do than how you want to solve the problem.
[09:32:44] <elon> remonvv: I get the idea, and in practice there's no real difference(updating a document with exactly the same values if it exists vs checking if the document exists, and if it doesn't creating one), but I thought there might be a dedicated method that doesn't overwrite anything.
[09:33:01] <elon> remonvv: I'll just use upsert. Thanks for your help
[09:33:51] <remonvv> elon: Hm, there is up to a point. You can use upsert in combination with $setOnInsert
[09:34:00] <remonvv> The latter only writes fields to a newly created document.
[09:34:34] <remonvv> But that's the only operator with the "if new" semantic
[09:38:23] <elon> remonvv: I see. Although I could add every field to $setOnInsert, I doubt there's a significant performance gain(if any!), and it would make my code much less clear. Thanks for looking that up, though.
[09:44:10] <remonvv> elon: There isn't any performance benefit if you're going to insert the entire document, no. And no problem ;)
[11:24:42] <pithagorians> hey folks. i'm new to mongo. i setup a 3 members replication and i kill the mongod process on primary member than start it again and i get in logs recover create file /var/lib/mongodb/local.25 2047MB
[11:24:55] <pithagorians> is it a snapshot in time or ...?
[12:09:36] <spicewiesel> I have 3 clean mongod instacnes, 3 clean configservers and the mongos. I want to set up ohne replicaset now and add it as a shard later. But I do not understand when and where I have to set the adminuser. Do I have to create the replicaset without user? do I have to create the admin user on every single mongod instance? Whould be great if anyone could help me with that.
[12:33:21] <rspijker> spicewiesel: the tutorial should be fairly clear about that
[12:39:01] <spicewiesel> do I have to set this user on
[12:39:01] <spicewiesel> a) one of the mongod instances, before/after setting up the rs00
[12:39:01] <spicewiesel> b) one every mongod instances, bevore/after setting up the rs00
[12:39:01] <spicewiesel> c) on mongos, after setting up the rs00
[12:39:01] <spicewiesel> I tried some things now and everytime I ended up in an "not authorized". Other users told me that the userAdminAnyDatabase role isn't enough, but the official tutorial tells to use this one for the admin
[12:40:11] <spicewiesel> I was able to add the admin user on my first mongod instance and it was synced in the rs00, as I was able to connect from the other instances with that credentials. But after that, I was not allowed to to rs.conf() with the admin user...
[12:40:11] <spicewiesel> So, I'm a little bit confused about the right management now
[12:43:27] <rspijker> spicewiesel: ah, okay. Well, I haven't used it myself in a long time, but this is what I remember
[12:43:48] <rspijker> you can just set it on the primary (after or before, shouldn't matter) and it will sync to the others
[12:43:54] <spicewiesel> and, if servers are started wit replSet option, I am not allowed to create an auser ("not master and slaveOk=false"), So I first have to create the rs, then I could create the user. Dunno if that is correct :)
[12:44:21] <rspijker> you should only get that if you try setting a user on a secondary
[12:44:55] <spicewiesel> rspijker: Ok, then it should be ok if I first create the replSet (using the localhost bypass to have the rights) and then I could create the adminsuer on instance1
[12:45:15] <spicewiesel> as there is no replSet at this point, there are no masters and no slaves.
[12:45:50] <spicewiesel> I think, with enabled replSet you have to create that set before creating users
[12:46:53] <rspijker> spicewiesel: if you start with replSet it is a replicated set...
[12:48:18] <spicewiesel> ok. I did rs.initiate and rs.config now, the replSet is now syncing. After that I could create the admin user, not?
[12:54:16] <spicewiesel> so, the next question is: wich roles does the admin user need
[12:54:16] <spicewiesel> The tutorial tells userAdminAnyDatabase, users yesterday said it's not enough, and an other howto adds the admin without any specific roles, just with "readOnly" : false
[12:55:09] <rspijker> userAdminAnyDatabase should be fine
[12:56:02] <rspijker> so just do exactly this: http://docs.mongodb.org/manual/tutorial/add-user-administrator/
[12:56:59] <spicewiesel> ok, that's what I did before, let's try again, maybe there was a mistake
[12:57:24] <spicewiesel> but, should I do that on my mongos, or on the mongod instance (f.g. PRIMARY)
[12:58:46] <rspijker> you can do it on the primary
[13:03:48] <spicewiesel> narf... I switched to db admin and created the user: admin, role "userAdminAnyDatabase". Now I'm no more allowed to use rs.conf()
[13:03:48] <spicewiesel> >> "$err" : "not authorized for query on local.system.replset",
[13:15:11] <Michae___> I know that the underlying index pId is unique, but db.config.collections says unique: false
[13:15:25] <Michae___> do I need to worry about that
[13:29:18] <Mr_O> i'm using javascript shell script to do updates on a collection. The db.collection.update does not return any status. How do i get to know if update applied or when somehting goes wrong ?
[13:30:35] <spicewiesel> the mongos knows from the confgdb parameter, where the configservers are running, but where is the connection to the mongod/replSet? I should auth against admin db at mongos to be able to setup my shard, but the auth fails. I think mognos/configsvrs just don't know about the replSet, where my admin user is configured now.
[13:44:20] <quiznilo> if you guys had a reference platform, what would it be?
[13:44:28] <quiznilo> I can't get this to build on a clean gentoo install
[13:44:50] <ron> oh yes, definitely go with gentoo.
[13:55:28] <spicewiesel> rspijker: I'm still trying. if my admin user got that role I'm not allowed to do replicaset stuff. I created the admin without a specific role now, and now I was able to set the replSet. After that I started my configservers, all fine there. Now I started mongos and added my rs00 as shard, that's done, too.
[13:56:00] <spicewiesel> I think I'm still confused. I cannot auth against db admin on mongos with my admin user.
[13:56:45] <rspijker> because your mongos isn't synced
[13:56:54] <rspijker> it's not a part of the replica set
[13:57:06] <rspijker> so adding it to your primary will add it to the secondary (it syncs) but not to the mongos
[13:57:38] <spicewiesel> ok, so how to I get that connection? The WebApp on the mongos server should be able to use the database I will create later.
[13:58:11] <rspijker> afaik you can just create the user on the mongos
[13:58:55] <spicewiesel> ok, than should I see the user management on the mongos completely seperated from the mongod/rs?
[14:02:33] <rspijker> spicewiesel: Come to think of it… I think you need key files for authentication on shared clusters...
[14:03:05] <spicewiesel> yes, I'm provided the key file to every component, mongod, mongo-configsvr and mongos
[14:04:20] <spicewiesel> ah, thanks. missed that page until now
[14:05:52] <spicewiesel> ok, so if I add a cluster admin on mongos, it will be stored on the configserver. That's fine, because my next question was "where does mongos store it credentials as it's not using a local data directory?" :)
[14:13:46] <spicewiesel> rspijker: thanks for your help so far!
[14:14:26] <spicewiesel> I have now an admin user for my rs00, and a clusterAdmin, created on mongos.
[14:17:17] <spicewiesel> now I have to solve the next problem, the new clusterAdmin is not allowed to execute sh.status(), as it's "not authorized for query on config.version". Same with show dbs and other commands :(
[14:18:14] <rspijker> where/how are you authing and where are you executing the query?
[14:20:20] <spicewiesel> I tried that on the mongos host:
[15:09:53] <Dreamer3> ERROR: BSON::InvalidKeyName:key Dealer.com must not contain '.' - can anyone point me to the commit that started causing this?
[15:10:15] <Dreamer3> we were using mongo / bson 1.6.2 ruby gems now that we're on 1.8.6 this is cropping up, but i can't find the commit that changed it
[15:11:56] <Dreamer3> far as i can tell the code has been in cbson for a long time
[15:17:14] <rspijker> Dreamer3: you shouldn't use dots in field names
[15:17:27] <rspijker> since it's the mechanism used to address fields within a document
[15:17:27] <Dreamer3> i get that, but i want to read the code changes that caused this
[15:17:36] <Dreamer3> right, but it's worked fine for years
[15:17:40] <rspijker> way back when some drivers allowed it
[15:29:39] <Dreamer3> before that keys were never checked
[16:04:57] <mdeboard> How do I deal with results returned from Casbah (Scala client)? It's just returning plain objects, and nested properties are quite difficult to work with, requiring manual finagling
[16:05:31] <mdeboard> I don't mind rolling my own solution but I'd like to make sure I'm not missing something obvious
[16:05:43] <mdeboard> Also how do I compare dates and so forth? The documentation is very unclear
[16:05:51] <mdeboard> the comparison operator documentation specifically
[16:07:43] <mdeboard> http://mongodb.github.io/casbah/guide/querying.html#query-operations as well, should I just give up and go read the Java driver docs?
[16:10:06] <rspijker> I've never worked with Casbah, sorry :(
[16:11:04] <rspijker> that should probably be your best resource though if you want to stick with it
[17:22:17] <__ls> hi everyone; i'm having an "BSONObj size is invalid" assertion error; i tried db.repairDatabase() but the issue persists. here's the offending code: http://pastie.org/8168046, and here's the error log: http://pastie.org/8168038
[17:23:46] <__ls> the error doesn't occur if i request 1700 instead of 1800 documents, but I'm not sure it's strictly a size issue; it might just be that somewhere in the final 100 there's a corrupted document in there (maybe?)
[17:24:54] <__ls> intuitively, the log "First element: ns: "esri.block_group"" would speak for something non-document specific (I've found other logs from people where the "first element" was an actual document), but then again, this is way beyond my mongodb knowledge ...
[17:27:41] <Kanara> can anyone point a newbie to info on why save() & insert() in node.js would complete happily but not store any data?
[19:17:23] <beniwzb> Hi all, there's something I'm missing about the docs. I have created an admin user, which has the following privileges: "userAdminAnyDatabase", "userAdmin", "readWriteAnyDatabase", "dbAdminAnyDatabase", "clusterAdmin" , however, if I connect with the mongo command line client I get: connecting to: test authentication fails (code 18) anything I'm missing here?
[19:18:15] <beniwzb> Also for completeness: If i us "admin" as the database on the command line, the client connects fine and I can see all databases
[19:35:41] <Kanara> ok, the mystery deepens. if i connect to "database1" which has been accessed by the node app I cant insert but if i connect to a new database i can, until the node app connects then the db becomes permenantly useless
[21:42:40] <VarunVijayarghav> When doing an endureIndex(), is there a difference between doing ensureIndex({timestamp: 1}) vs ensureIndex({timestamp : -1})
[21:43:03] <VarunVijayarghav> assuming timestamp is an ISODate object
[21:48:40] <cheeser> VarunVijayarghav: not in practice, no, i don't think.
[21:49:01] <cheeser> there might be some nuance to how you query or order, though.
[21:51:12] <jcromartie> kali: by the way, you *can* use dots in collection names at the shell
[22:08:13] <jwm> yeah my rubber duck is in the shop
[22:16:43] <giraffeslacks> hi. i'm building a ticketing system and am fairly unfamiliar with the mongodb paradigm. generally tickets get a unique sequential ID. mongodb doesn't do it without workarounds and to the detriment of scalability (according to the research I've done.)
[22:17:13] <giraffeslacks> so i'd like to do this a more appropriate way from the start. any suggestions on how to use _id to represent/generate a human-readable ID?
[22:17:46] <giraffeslacks> i was thinking of displaying just the last 5-6 digits of the _id... but that seems like a plan for failure (even if a collision might be extremely unlikely.)
[22:18:05] <preaction> giraffeslacks: the ORM i'm using does it for me, but it still has the _id. keep the _id, add a number field