[00:38:49] <dev__> I have set up MongoDB 2.6.7 on an ubuntu server and have been trying to make it enforce authentication. I have set up a superuser and added auth=true to mongodb.conf. and restarted the service. what else is there to do? because it still just takes me directly to the test data without asking for a username and pw.
[01:25:32] <dev__> I have set up MongoDB 2.6.7 on an ubuntu server and have been trying to make it enforce authentication. I have set up a superuser, added auth=true to mongodb.conf, and restarted the service. what else is there to do? because it still just takes me directly to the test data without asking for a username and pw. What step am I missing?
[01:27:12] <checkit> Hey guys... Mongo newb here... Trying to figure out the simple things... Start/Stop?
[01:28:07] <dev__> how to start and stop the service?
[01:39:15] <dev__> but that is from 2012. idk what version mongodb that is for.. seems ridiculous that there isn't a clean way to start and stop the mongod process on osx
[01:42:09] <checkit> Or by simply issueing kill pid
[01:42:39] <checkit> dev__: I was thinking there might have been a more graceful approach.
[01:43:29] <dev__> on ubuntu there is but idk why there isn't on osx
[01:47:22] <dev__> checkit: i don't suppose you k now how to set up authentication on mongodb? I have set up MongoDB 2.6.7 on an ubuntu server and have been trying to make it enforce authentication. I have set up a superuser, added auth=true to mongodb.conf, and restarted the service. Any idea what step I am missing? because it still just takes me directly to the test database without asking for a username and pw.
[02:32:56] <acidjazz> was going to bug/google this but i think its actually a DNS error on my side
[02:37:13] <dev__> well good luck getting that answered. I brand new to mongodb, been sitting in here for a few hours asking my question occasionally without any response
[02:44:19] <dev__> I have set up MongoDB 2.6.7 on an ubuntu server and have been trying to make it enforce authentication. I have set up a superuser, added auth=true to mongodb.conf, and restarted the service. Any idea what step I am missing? because it still just takes me directly to the test database without asking for a username and pw.
[02:47:06] <dev__> i am not sure if it isn't asking me for authentication because I am running mongo locally via root... so i've been trying to remote in to the mongodb server from my own machine and haven't been able to successfully connect
[02:53:42] <Boomtime> dev__: "it still just takes me directly to the test database without asking ..." -> have you tried doing anything?
[02:54:06] <Boomtime> just because the cursor says "test" doesn't mean the shell has actually attempted any operation
[02:55:27] <dev__> ok so it would allow someone without credentials to still open a connection and keep it open? even if it won't let them perform operations?
[02:55:42] <Boomtime> how would it stop someone from 'opening' a connection?
[02:56:12] <Boomtime> it's true it should drop it after a while, i don't know if there is a way to do that
[02:56:26] <dev__> by asking them for a username and password and if they don't have it turning them away
[02:56:42] <dev__> could I ask why you put opening in quotes?
[02:56:47] <Boomtime> sadly, that isn't how the wire protocol works, all commands are push
[02:57:07] <Boomtime> because opening a connection is at the TCP layer, the server has no say
[02:58:28] <Boomtime> if you want proper TCP level auth, you should use X.509, that way the authentication is done on establishment of the connection, and only access rights remain to be processed
[03:33:18] <acidjazz> does mongoose have some option to show the raw mongo command? it shoudl at least dump that upon an error
[04:00:20] <GothAlice> I've got 99 problems, and Mongoose is most of them. :/
[05:36:23] <GothAlice> "[I] never set up mongo to require auth, always just setup my stuff to where only my web servers can connect" — ah. acidjazz: That's… one approach. Firewall rules?
[05:37:53] <GothAlice> 'Cause source address limiting might prevent data egress, but it won't stop someone from deleting everything. Or injecting data. Or spontaneously joining your server to a replicaset.
[10:02:04] <metathink> Is there a Bulk system which can handle insertions on many collections ?
[10:15:13] <metathink> I use mongodb to save logs, but because I need to frequently delete a large amount of categories of this logs, so I insert each category in a specific collection to be able to use db.collection.drop() without delay. I also put the received logs in a "buffer" and bulk insert them every X seconds. But if there was to many differents categories buffered before the X seconds passed, I have to do to a lot of bulk
[10:15:15] <metathink> insert in the same time. Any idea?
[10:43:04] <metathink> Well sorry, it seems to be efficient.
[14:25:49] <quakephil_> I'm doing a db.blah.insert() and then a db.blah.find() but the find is not finding the latest insert. But if I do the find a couple seconds later, it finds the inserted document. So it looks like a timing issue on my end. Is there a better way to do an insert-one-document-and-then-find-all-documents-including-the-inserted-one than the way I'm doing it?
[14:32:08] <quakephil_> I suppose the right approach to do the find first, add the to-be-inserted document to that local collection, and then do the insert separately?
[14:57:23] <mazzy> I'm trying running mongodb but I got this error SEVERE: Failed global initialization: FileNotOpen Failed to open "/log/mongodb.log"
[14:59:07] <mazzy> here is my config file http://pastebin.com/yz5m1dtm
[15:21:32] <jaitaiwan> quakephil_ you probably want to check the write concern to make sure your insert doesn't return till its been propogated to all servers and disks: http://docs.mongodb.org/manual/core/write-concern/
[15:22:16] <jaitaiwan> mazzy: does /log/ actually exist? if so, does it have the right file permissions?
[15:23:46] <mazzy> I have just figure out that maybe it doesn't have the right permission to execute
[15:23:59] <mazzy> I'm running mongo into official mongo docker image
[15:24:28] <mazzy> I need to fix the permission of the log file giving it mongod user and group
[15:29:23] <jaitaiwan> probably also needs enough permissions to write to /log/ too because it may archive old logs
[15:29:30] <mazzy> I just need to figure out how to give right permission without rebuild again mongo docker image
[15:30:04] <lilgiant> hello, one question: i run a "db.COLLECTION.ensureIndex({FIELD:1},{unique: true, dropDups: true})" command on a COLLECTION. After some factorization I want to change the field, which should be indexed and unique. Is it save to just run "db.COLLECTION.ensureIndex({NEW_FIELD:1},{unique: true, dropDups: true})" ?
[15:32:50] <jaitaiwan> lilgiant: depends on what you mean by safe
[15:33:14] <jaitaiwan> Im pretty sure you have to delete the index either way to run ensure index a second time
[15:37:13] <lilgiant> yes, "safe" is a littel bit fuzzy: do i have to run a command to remove the index and the unique attribute for the field FIELD or is it done implicit by running the new ensueIndex command
[15:39:14] <jaitaiwan> lilgiant: If its the same field you'd have to delete the index first but in this case you're creating an index on a new field. You should be able to create the index without deleting the existing one
[15:44:22] <lilgiant> one more question: does "mongodump --coolection MYCOLLECTION ..." also backup the index of the collection or do i have to created it after restoring a backup?
[15:46:53] <jaitaiwan> lilgiant: can't be entirely certain but I don't think it does: http://docs.mongodb.org/manual/core/backups/#backup-with-file-copies
[16:23:30] <lilgiant> is there a way to check, if the index was created on all docs of a collection? i created a new index and i couldn't see any cpu or io impact on the mongo server.
[16:24:08] <jaitaiwan> The index isn't stored on a collection so much as stored seperately as far as I remember
[16:24:42] <jaitaiwan> If you can see the index in the listindexes then you should be right
[16:25:31] <lilgiant> yes, the index is shown on db.system.indexes.find()
[16:25:41] <jaitaiwan> great. That should be fine then
[16:26:21] <jaitaiwan> I only saw a massive difference in cpu when I did a multiple text index on a 50million strong collection
[16:30:11] <lilgiant> ok, i have currently around 30k docs in the collection. creating indices on a similar mysqldb does affect the performance of the server much more, so i was just wondering :)
[16:50:15] <blizzow_> I amd trying to create a user mor monitoring/maintenance on my mongos instance that will have access to look at local oplog on my sharded replica set members. What db on my mongos instance do I need to add the user to and what roles do I need to add? I tried to add a maintenance user to the admin database with clusterAdmin and I get access errors about connecting to local.oplog.
[17:52:16] <bros> What does this error say to you? Error: MongoError: E11000 duplicate key error index: db.accounts.$users.email_1 dup key: { : null }
[17:52:26] <bros> I understand everything except the { : null } aspect.
[18:01:47] <preaction> you're trying to save a new document that doesn't have a value for "email"
[18:17:12] <bros> preaction, I have a collection called "account" with an embedded array of objects called "users" with then unique index on the email key of users.
[18:17:34] <bros> How do I create an account, then create a user?
[18:21:27] <bros> Thank you very much. I was not aware. My half-ass SQL background was screwing me more than it was assisting me.
[18:25:13] <preaction> if you flattened that schema into a relational table, it'd be the same result. you could have an accounts collection and a users collection, then they wouldn't be so dependent on each other
[18:45:56] <bros> preaction, I was told to embed them.
[18:52:49] <preaction> if you would otherwise _always_ join a table in order to have a meaningful query, then embedding a document is good
[18:53:24] <preaction> if the information is tightly-bound and is not really meaningful without the parent document, embedding it is probably good
[18:55:08] <bros> The same could be achieved with arrays of reference ObjectIds
[18:55:22] <preaction> if you were previously serializing xml or json and embedding that in a column, embedding it is probably good
[18:55:32] <preaction> sure, but then you need to go look up that data in another place
[18:55:39] <preaction> you _can_ do lots of things
[19:04:33] <GothAlice> I often link http://www.javaworld.com/article/2088406/enterprise-java/how-to-screw-up-your-mongodb-schema-design.html as a general overview of schema design considerations. There's also http://effectif.com/mongodb/mongodb-schema-design, and two presentations: https://www.youtube.com/watch?v=PIWVFUtBV1Q (O'Reilly Webcast) and http://www.mongodb.com/presentations/schema-design-example-2 (Schema Design by Example)
[19:05:05] <GothAlice> Not to mention many more search results and many hideously designed blogs one could persue.
[19:05:37] <GothAlice> (From the first link: "Identifying documents is key.")
[19:10:44] <bros> preaction, This is a bit off topic. Would you bother to check if a database result is null after the user has authenticated their credentials through encrypted tokens?
[19:11:32] <bros> Are you familiar with JSON Web Tokens?
[19:13:06] <bros> How do I make a key a unique index only relative to the document that contains it?
[19:16:00] <preaction> make it a combined key with the parent document's id, is my guess
[19:19:49] <bros> preaction, I don't understand. :/
[19:29:58] <mordonez> Hi guys, if I create an index after some data was already added, is the data already added included in the index? if no, whta is the right way to handle that situation?
[19:31:01] <GothAlice> If you build the index normally when the operation completes your data is indexed. If you tell it to index in the background it may take a _very_ long time before the index becomes usable, however again, all your data will have been included. (The former method will block use of the collection being indexed until it's done, the latter will not.)