[10:10:22] <partycoder> however you won't notice it on a small collection
[10:10:45] <partycoder> you can use "explain" to get the execution plan for a query
[10:15:04] <mylord> how to I use update to only update fields I provide, and not replace whole object?
[10:15:32] <mylord> Must I use $set on an array of fields? Or some nicer way?
[10:18:57] <Derick> you need to use $set : { field1: value, feidl2: value }
[10:54:44] <Lope> any ideas what happened to the other find params, such as projection? http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#find
[11:12:34] <Boomtime> @Lope: the url you gives shows a projection in the third example
[11:14:20] <Lope> Boomtime: thanks, sorry I forgot to say I saw that. I was a bit confused because I was previously using the mongojs implementation.
[11:48:11] <jhalliday> https://jira.mongodb.org/browse/HADOOP-143 - anyone know why this is marked fixed even though it isn't?
[11:58:18] <kurushiyama> jhalliday: You updated accordingly?
[12:22:16] <cheeser> it was marked fixed because it was believed to be fixed. if you're finding that's not the case, please file a new ticket.
[14:22:33] <cheeser> only if you state the actual problem. right now all anyone can do is guess. so save everyone some time and explain the problem. if someone knows a solution, perhaps they'll speak up.
[14:29:32] <Fadey> I tried everything I know with the permissions.. I don't know what else I can do
[14:39:03] <Fadey> you can find my question also on stackoverflow: http://stackoverflow.com/questions/35630148/mongodb-2-6-11-wont-start-after-changing-dbpath-centos-7
[14:40:03] <jhalliday> sure it's perms rather than selinux labels?
[14:41:01] <cheeser> can you copy that data over rather than use it off the mounted drive?
[14:43:19] <Fadey> I could copy but it will take tons of time
[14:43:35] <Fadey> Im not sure it's not a selinux labels
[14:43:39] <cheeser> well, you're not getting anything done now... :)
[14:43:57] <Fadey> I dont even know how to handle selinux
[14:44:35] <Fadey> cheeser that's true :) but that's a poc for like 20 machines that needs to migrate
[14:45:18] <Fadey> I'd rather leave the data outside the root drive and have it ready to mount
[14:47:39] <foxnesn> i have a record local:{email:"blah@blah.com",password:"123456"} how on earth do i do a findOne for it?
[18:48:00] <StephenLynx> because mongo queries are not strings
[18:48:07] <StephenLynx> so no matter what is in that string, it won't change a thing.
[18:49:30] <Trinity> okay, so make sure input is not an object and that's it? of course also testing for acceptable characters would be even better but is there anything else to be aware of?
[18:49:45] <StephenLynx> no need to bother with specific characters.
[18:50:14] <StephenLynx> and yeah, pretty much if the input is not an object, it won't be able to cause anything.
[18:50:28] <StephenLynx> it will either match or not.
[18:50:47] <Trinity> okay, great. I think I understand it better now. Thanks StephenLynx :)
[19:32:23] <diggitydane> I'm signing up users through passport and I want them to only edit their own resources/documents. Is adding a user to the document and then always finding by document._id and user._id the right way to do this? I'm new to mongo, and it feels very RDB, but not sure how else to do it
[19:35:15] <foxnesn> diggitydane i am in a similiar boat coming from oracle
[19:35:24] <foxnesn> trying to learn mongo best practice
[19:36:07] <foxnesn> like if i have a users collection which contains email and a products collection how can i relate them?
[19:36:19] <foxnesn> i guess mongo 3.2 has the abilty to "join" collections
[19:37:44] <diggitydane> foxnesn, yeah, I can't find any good examples for users only editing their stuff. All the searches I do reference the mongo Users and Roles, which appears different than "end users"
[19:38:58] <diggitydane> I made a UserSchema, and then in the document I do: user: { type: ObjectId, ref: 'UserSchema' }. So it allows me to find anything by that user._id, but again, not sure if that's the right way
[19:52:05] <diggitydane> so how do you only pull a users documents and not allow them to edit others documents? I'm having a disconnect there and can't find a good resource that explains it
[19:52:06] <StephenLynx> so is it just a 1-1 relation?
[19:52:33] <diggitydane> 1 to many. a user could add many recipes
[19:52:46] <StephenLynx> then why not have an embedded array on the user?
[19:53:16] <StephenLynx> containing all of its recipes?
[19:53:26] <StephenLynx> and your model doesn't describe the recipes.
[19:53:58] <StephenLynx> all I can see is the relation between the user and the social media data.
[19:54:07] <StephenLynx> and even then I don't get it because its just a mongoose definition
[19:54:16] <diggitydane> yeah, I'm not adding a reference of recipes to user.
[19:57:30] <diggitydane> a user can add many recipes. guess I'm not sure what the question is. I'm using the user ref in recipes to know who added what. So, mongo way would be add all recipes into user document?
[19:57:39] <StephenLynx> when you use web frameworks, the actual runtime environment becomes a black box.
[19:57:59] <StephenLynx> you are on auto pilot and won't be able to dodge a crash when you try to land that plane.
[19:58:19] <StephenLynx> diggitydane, your recipes are not on that model.
[20:00:56] <diggitydane> which model? and I guess to clear confusion, what are you referring to when you say model? recipe model? It's defined in RecipeSchema in the first snippet
[20:01:47] <StephenLynx> how is your data organized? what are its constraints? what does each part of your data means?
[20:02:43] <StephenLynx> what you showed me doesn't even explain the collection you are asking how to organize.
[20:03:57] <diggitydane> hmm, that's all there is. recipe has name, description, tags (array) and "foreign key" to user. User is facebook info used by passport. that's it. I'm assuming the mongo model definition is close to the mongoose schema definition.
[20:04:10] <diggitydane> was that model.txt file generated, or someone wrote it out?
[20:11:48] <StephenLynx> and you could have just an array of recipes on the user document.
[20:12:19] <StephenLynx> and the facebook information could be flat.
[20:12:41] <StephenLynx> that object there serves no practical purpose.
[20:13:23] <foxnesn> not unless he adds more auth strategies
[20:13:39] <diggitydane> I guess that's my question. I'm just trying to build something simple that I can wrap my head around mongo. Is it better embeded in user, or it's own with a relation? From here, I'm going to add ingredients to a recipe. Is that it's own model, or is that embeded in a recipe as an array, etc.
[20:15:08] <StephenLynx> if your recipes are going to become complex
[20:15:17] <StephenLynx> then you might have separate documents.
[20:15:30] <StephenLynx> because complex objects on embedded arrays can become hard to work with.
[20:15:32] <diggitydane> yeah, would that just be added into recipes or it's own collection. then I want to search, and give me all recipes that have chicken
[20:15:45] <StephenLynx> and you lose some features from embedded arrays.
[20:16:09] <StephenLynx> if your embedded array elements are going to have more embedded arrays, then you might as well keep them on separate documents.
[20:16:24] <diggitydane> yeah, I'm trying to figure out where the trade off's are
[20:17:23] <diggitydane> users have recipes, recipes have ingredients. should I have users collection, recipes collection, and ingredients collection? user case scenario would be, what recipes have ingredients X?
[20:17:34] <foxnesn> diggitydane how do you relate your recipes and ingredients docs?
[20:17:58] <StephenLynx> i suggest you just keep users and recipes
[20:18:13] <StephenLynx> how complex do you plan to have recipes?
[20:18:42] <StephenLynx> what do you plan to put on "tags"?
[20:18:53] <StephenLynx> this is why you lay out documentation for the model.
[20:18:59] <diggitydane> foxnesn, I'm just playing with the ingredients now. trying it as embeded in recipes, and then as it's own collection
[20:19:18] <StephenLynx> if tags are just strings, then keep tags embedded on recipes.
[20:19:56] <foxnesn> i thought the whole point of document oriented database was to not relate things
[20:20:02] <diggitydane> foxnesn, it just feels like everything I'm trying is "relational" in nature, so I'm assuming I'm doing it incorrectly for mongo :) but trying to learn how to do it without
[20:20:52] <StephenLynx> document oriented dbs are about flexibility.
[20:21:09] <StephenLynx> you can embed, you can relate and its all about context.
[20:21:19] <StephenLynx> sure, theres a point where its better to just use a different db.
[20:21:27] <StephenLynx> but you have a certain degree of freedom.
[20:25:02] <diggitydane> so, in this case, is it appropriate to have the user ref on recipes, and then when I'm interacting with mongo add in user like .... db.recipes.find({ _id: ObjectId('56cf53a63fa3c061115f01d4'), user: ObjectId('56cc9a28cc22244c05f9b7f3') })
[20:25:22] <StephenLynx> why look for both the _id and user?
[20:25:44] <StephenLynx> if you are looking for the _id, the user is pointless, _id is unique.
[20:26:00] <diggitydane> otherwise, on angular app that uses a resource like ('/api/recipes/:recipeId'), someone can just type in the id and edit it
[20:26:13] <StephenLynx> don't couple the FE into this.
[20:26:30] <diggitydane> how do you restrict a user to their own documents then?
[22:18:58] <bros> Is this not supported, or do I just need to use a sparse index?
[22:19:48] <kurushiyama> bros: In general, yes. But keep in mind that for purposes of a unqiue index, non-existing values also are null
[22:20:09] <bros> kurushiyama: Sorry. To clarify, that is, "yes, use a sparse index"?
[22:20:54] <bros> Should I use a partial index instead?
[22:21:30] <kurushiyama> bros: Sorry. Yes, you can use a sparse index. But it heavily depends on your use case. Actually some people insert dummy docs with null values to prevent further null values to be enterd
[22:22:26] <kurushiyama> bros: Albeit I am not sure if an explicit null would trigger the unique constraint anyway...
[22:22:35] <bros> It's actually that the array is empty?
[22:23:29] <kurushiyama> bros: If it is aempty, the corresponding fields of the subdocuments store in the array evaluate to null.
[22:23:44] <bros> Ok. So that is what is causing that error, yes?
[22:23:57] <bros> I am running 3.2. Should I roll a partial index or not even bother?
[22:24:13] <bros> I have server-side checks and don't actually use the constraint, to be honest.
[22:24:23] <bros> I just had to clean up 13k documents to get it to pass.
[22:25:24] <kurushiyama> bros: Well, how should I know? If you dont know your use cases – who does? Instead of a unique index, you might want to give document validation a try. Although I am a big fan of keeping logic where it really belongs to: your code.
[22:25:48] <bros> So you aren't a big fan of unique indexes either?
[22:25:57] <bros> I almost always precede with a .count() to see if it exists anyway.
[22:29:32] <kurushiyama> bros: Unique indices have their uses, of course. Let's take usernames for a webapp, for example. You most likely will check via AJAX while the user types their wanted username. Does a unique index still make sense? Of course, in case somebody tries to bypass you validation logic and simply sends a POST request with a known username and a new password. You are doing an insert on a unique constraint then, causing an e
[22:38:47] <Hitsnorth> If I take that out of the conf it boots up just fine (But of course with no security)
[22:39:33] <kurushiyama> Hitsnorth: Well. I am not really convinced ;) Since you seem to use YAML format: Are you sure you need the quotes? Are you sure you indented correctly?
[22:39:57] <Hitsnorth> Im not sure I need the quotes but thats hwo I saw it (I initially didnt use the quotes).
[22:41:25] <kurushiyama> Hitsnorth: No quotes, space indented should work
[22:41:47] <Hitsnorth> I put 2 spaces it appears to work
[22:44:53] <kurushiyama> Hitsnorth: So problem solved?
[22:45:59] <Spynxic> I'm having a problem grabbing the value of an element in a collection, I use the follow statement to call for the _id value: db.collectionname.containers[index]["_id"] but it returns Collection(Database(MongoClient('localhost', 27017)u'graphs'), u'collectionname.containers.index._id')
[22:46:56] <Spynxic> should mention that it's in pymongo
[22:47:19] <bros> Does this sound right: Profiling is showing that a query I have an index for took 400ms.
[23:03:27] <kurushiyama> Hitsnorth: Do you have a standalone instance or a replset/sharded cluster? For the former, you don't need it, otherwise: https://docs.mongodb.org/manual/tutorial/enable-internal-authentication/#enable-internal-authentication
[23:04:34] <kurushiyama> Hitsnorth: And it doesnt crash. It shuts down because of misconfiguration ;) YAML – Yet Another Mistake Loop
[23:04:47] <dreamreal> I'm trying to query an object that looks like { "_id":"blah", "foo":"bar", "emails":[{"address":"foo@bar.com"}]} such that I can find that record given foo@bar.com
[23:04:53] <dreamreal> I'm not sure how to form that query
[23:05:58] <bros> key items.item_id must not contain '.'
[23:06:12] <bros> The . is referring to a subdocument, like always? I'm a little lost.
[23:16:15] <Spynxic> Is there a name attributed to the index of an element in an array, for example db.coll.find({"array.key":0}) to find the first element
[23:17:24] <kurushiyama> Hitsnorth: In a lot of environments an exclamation marks has special meanings, so you might want to quote it...
[23:54:40] <kurushiyama> Doyle: maybe already finished on the others? Is the shard key involved? Is it a sharded collection, or is it unsharded and the first shard is the rpimary shard of the DB?
[23:55:26] <Spynxic> Are all the contents of a cursor loaded in memory (ram) when its created? (similar to a dict)
[23:56:30] <kurushiyama> Spynxic: Not too sure about pymongo, but usually not. In general, a cursor is a server side iterator.
[23:57:19] <Doyle> kurushiyama, AH, yes! The index operations went sideways on one and pegged the IO on the index volume at 100%, so I killed them and restarted the index creation
[23:57:33] <Doyle> without dropping the index fully, that would make sense