PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Tuesday the 22nd of October, 2013

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:10:54] <snkcld> does an upsert not go through if no _id is provided?
[00:17:15] <cheeser> you don't need to provide one, no.
[00:18:32] <joannac> snkcld: http://pastebin.com/2jHxSg1m
[00:18:54] <joannac> so, what cheeser said. Damn you cheeser /me shakes fist
[00:32:12] <cheeser> joannac: :D
[00:33:36] <sw99> hi, is someone here using Mongoose on Express.js?
[00:44:47] <snkcld> how does one ensure that a field is in all documents of a collection?
[00:45:01] <snkcld> for example, favorite_artists, such that when a new document is created, it would always have that field?
[00:45:15] <Goopyo> mongdb doesnt enforce schemas...
[00:45:36] <snkcld> Goopyo, yea... thought so
[00:45:48] <ruphos> you can add the logic program side
[00:45:57] <snkcld> yea yea ruphos thats what i was about to ask.
[00:45:58] <Goopyo> you should*
[00:55:24] <ruphos> I'm trying to migrate utf8 encoded text from the subdocument of one collection to its own collection with the perl MongoDB driver. It throws errors on the utf-specific characters ("Wide character in subroutine entry at /usr/local/lib/perl/5.14.2/MongoDB/Collection.pm line 168"). Is this just an issue with the perl driver, or is there special handling to be done with utf8?
[01:01:12] <vl4kn0> Is there a way to do 'binary search' instead of fulltext search? Meaning fulltext search except accepting all values ranging from 0 - 255 ?
[02:41:27] <cesarkawakami> vl4kn0: "fulltext" usually means taking into account some characteristics of natural language. Which will naturally not be present in binary data. What do you want to do?
[02:41:35] <cesarkawakami> wow 2h lag. Sorry.
[03:30:20] <raar> How do I set the default connection parameters of my mongo client? I want to change the default port to 27018 instead of 27017..
[03:30:44] <raar> So when I type 'mongo', it connects to 127.0.0.1:27018
[03:33:27] <cheeser> http://docs.mongodb.org/manual/reference/configuration-options/
[03:38:40] <cheeser> there's no clear consensus on if the client uses that config file or not but if it doesn't (which probably isn't likely) then you're SOL on a permanent configuration. you'll just have to pass an option each time
[03:53:12] <jfisk87> hey all
[03:53:32] <jfisk87> im having issues updating an array
[03:53:33] <jfisk87> http://pastebin.com/YzcTF9gY
[03:53:57] <jfisk87> the key is detectedApps, its not getting an error but it isnt updating the field
[03:56:07] <joannac> jfisk87: Does the find work?
[03:56:18] <joannac> if you do a find with your id?
[03:56:58] <jfisk87> in the mongo shell yes
[03:58:45] <joannac> jfisk87: in your code, if you replace the call to update with a call to find, does it find the correct thing?
[03:58:59] <jfisk87> doing that now :)
[04:03:29] <jfisk87> its not fidning them
[04:03:41] <jfisk87> http://d.pr/n/AsAs
[04:03:46] <jfisk87> that prints out undefined
[04:04:54] <jfisk87> "_id" : ObjectId("5265f554b9b933da37000001") is my id in mongo
[04:12:31] <raar> cheeser: thank you, that's great!
[04:15:24] <cheeser> if it works. :)
[07:26:48] <[AD]Turbo> hi there
[10:55:11] <lqez> Hi- I just created a web-based MongoDB query string generator -
[10:55:11] <lqez> http://lqez.github.io/logiform/
[10:55:27] <lqez> welcome patch-
[11:03:31] <Nodex> kudos
[11:15:44] <Nomikos> lqez: that looks pretty nice!
[11:16:21] <lqez> Thanks- Nomikos, Nodex- I created it for my MongoDB-based web applications. (dog food kkk)
[11:43:33] <velan> Mongo db store my internla objects as [object Object] Why it is happening
[12:59:04] <Nodex> http://www.rackspace.com/blog/zerovm-smaller-lighter-faster/
[12:59:11] <Nodex> interesting
[13:23:44] <singler> hello, I just noticed that there are not images in the docs. Is it a known problem?
[13:34:35] <Number6> singler: Do you have an example page?
[13:35:06] <singler> http://docs.mongodb.org/manual/core/replica-set-primary/
[13:37:47] <cheeser> alt tags++
[13:37:58] <cheeser> Number6: want to file a docs bug or shall i?
[13:38:23] <Number6> cheeser: Already done - https://jira.mongodb.org/browse/DOCS-2136
[13:38:28] <cheeser> w00t
[13:52:43] <banditron> diagrams aren't loading in the docs. e.g. http://docs.mongodb.org/manual/core/crud-introduction/
[13:53:15] <CupOfCocoa> Hey guys, I use pymongo as my driver and want to access the id of some documents in a cursor. specifically, I want to build a list of all the document ID's from the cursor to insert that list into a new document, so basically my document 2 contains a grouping of some documents 1 with some additional info. How would I go about this? A straightforward [p['id'] for p in cursor] leads to nothing
[13:55:43] <Number6> banditron: Already done - https://jira.mongodb.org/browse/DOCS-2136
[13:56:25] <banditron> Number6: thanks! i searched for "diagrams". -_-
[14:08:55] <Number6> singler and banditron: Resolved \o/
[14:09:02] <Number6> Thanks for letting me know
[14:09:23] <singler> np
[14:10:58] <vl4kn0> Is there a way to use mongodb search facilities to search for any other than string values? I've got N integer values ranging from 0 to 255 and need to do fulltext search on them (the values are not actually any meaningfull strings)
[14:14:32] <cheeser> $in?
[14:25:38] <vl4kn0> cheeser: unless I can do [11, 23, 45] $in [1, 2, 11, 23, 45, 55, 67] then no
[14:27:44] <Nodex> you can $or that
[14:27:59] <Nodex> 11 or 23 or 45 $in [...]
[14:47:24] <Nodex> https://www.youtube.com/watch?feature=player_embedded&v=RZp7BvQJnU8#
[15:17:39] <vl4kn0> Nodex: still not what I'm looking for, I need to look for a vector for an occurence in a smaller vector, not any of the elements within the vector
[15:25:20] <guilhermekfe> hey gentlemen
[15:27:19] <t432> is mongodb suitable to store edges? like follow/block relationships?
[15:27:25] <guilhermekfe> how should I proceed in order to filter the documents in that format http://pastie.org/8421600
[15:27:38] <guilhermekfe> based on _id and projects.project_id
[15:31:44] <t432> anyone?
[15:32:03] <Nodex> vl4kn0 : perhaps you could explain it in better english than that, I don't understand complex words
[15:32:15] <Nodex> t432 : not at scale
[15:32:29] <t432> thanks
[15:35:12] <guilhermekfe> Actually I'm using "User.find({ _id: user_id, 'projects.project_id': { $in : project_id } }, function(err, user) {..."
[15:35:30] <guilhermekfe> But I get this error, "[TypeError: Object 5265c8c65060a0180b000002 has no method 'map']"
[15:36:15] <Nodex> guilhermekfe : probably somehting to do with your driver
[15:37:20] <guilhermekfe> Nodex: I'm using the node.js version
[15:38:19] <Nodex> the native driver?
[15:38:41] <Nodex> you might need to pastebin your code
[15:40:21] <guilhermekfe> Nodex, http://pastie.org/8421632
[15:41:00] <Nodex> do you not have to cast the user_id to an object?
[15:41:25] <guilhermekfe> Well, it was working without the cast
[15:41:35] <guilhermekfe> But let's try
[15:41:38] <Nodex> also .... $in : project_id ... -> $in : [project_id]
[15:41:44] <Nodex> $in expects an array ;)
[15:44:09] <guilhermekfe> Oh, thanks =)
[15:44:11] <guilhermekfe> It's not working yet
[15:44:35] <guilhermekfe> But I think I know the issue... I changed the type of project_id in User Schema
[15:45:04] <guilhermekfe> I'm very new to no-sql concepts, and I have this doubt regarding one-to-many relations
[15:45:42] <guilhermekfe> This is how I'm declaring the Schema http://pastie.org/8421648
[15:46:33] <guilhermekfe> My doubt is, should I use String for project_id, and then take out ref... or is this the best way?
[15:50:31] <guilhermekfe> Nodex, It would be very helpful to know which is the correct =)
[15:52:02] <salty-horse> hey. I'm pondering what's faster: whether I should perform two updates, one of which produces a duplicate key error, or instead do a find() followed by a single update. Is there a performance penalty because of the error generated on the server?
[15:52:37] <Derick> salty-horse: upsert
[15:52:58] <Derick> which is an option to update
[15:53:25] <Derick> it will update when it matches the criteria, and if it doesn't find a doc matching the criteria, add one
[15:54:31] <salty-horse> derick: The first update mentioned is an upsert with a conditional: So it can either (1) succeed silently, (2) perform an insert, or (3) fail with dup key error due to the full conditional not matching any and insert failing for the duplicate key. that's not my question though :)
[15:54:51] <Derick> ic
[15:55:23] <Derick> find + single update I think is better, but I'd say try it with production load and data :-)
[15:55:33] <salty-horse> I'm just wondering if the duplicate key error is tasking the server somehow. maybe it needs to return extra data to the client, and I'm better off just doing the find() first doing things right :)
[15:55:48] <salty-horse> Derick: good idea! :)
[16:48:34] <fuzzi> good night guy, im having an issue again with the _id generation.
[16:49:24] <fuzzi> my client (mongodb-native, jscript), dropped the connection, and now my collection is corrupted.
[16:49:47] <fuzzi> i already tried db.coll.validate(), and it was valid.
[16:50:02] <fuzzi> the problem is, it generates invalid ids, for example:
[17:00:18] <cheeser> figured it out, i guess.
[17:28:09] <mboman> How can I query a subdocument? I have pefunctions.[list of dlls].[list of functions] and I want to query for a specific function but I don't know (beforehand) which DLL it is located in
[17:28:58] <mboman> so I want to do something like find({"pefunctions.*" : "myFunction"})
[17:33:20] <jyee> mboman: http://docs.mongodb.org/manual/reference/operator/aggregation/unwind/
[17:42:57] <mboman> jyee, not sure I understand the document. I've pasted an example document at http://pastebin.com/BnjDfqDs which is from db.metadata.find().limit(1). How can I query for "IsDebuggerPresent" in pefunctions.* without knowing that I should be looking in KERNEL32?
[17:44:43] <jyee> ah. i see.
[17:51:07] <rh1n0> Anyone seen where a version upgrade causes 0 objects to be returned (using mongoid). saving/writing works fine. We just upgraded to 2.4.6 on ubuntu. tx
[17:54:09] <mboman> jyee, any ideas?
[17:56:15] <jyee> http://stackoverflow.com/questions/6790819/searching-for-value-of-any-field-in-mongodb-without-explicitly-naming-it
[17:56:58] <jyee> http://stackoverflow.com/questions/10901151/mongodb-query-without-field-name
[17:57:36] <jyee> i was going to say that it's not possible, except for doing it app side, but those ^^ suggest with a schema change to use an array, you could do it.
[17:57:48] <retran> can do a map reduce where you shove all the data into a single field, and the ObjectId in a separate field
[17:58:21] <retran> then search on your single field, and get returned the ObjectId of the original object
[17:59:15] <retran> by "shove" i mean concat the values of all the fields
[19:04:06] <squeakytoy> Need some suggestions. I have two collections; Users and Videos. Now a user should be able to "like" a video. Should I store that in the Video document? { likes: [ *user ids* ] } ? That will be a crazy long list for each Video Document.
[19:08:58] <tripflex> squeakytoy: depends on how you use the data
[19:09:11] <tripflex> but i would say store it in the user for their likes
[19:09:14] <squeakytoy> When i fetch the video, I need to also show the number of views
[19:09:28] <tripflex> i would store that under video
[19:09:33] <squeakytoy> need them both ways
[19:09:37] <squeakytoy> ?
[19:10:06] <squeakytoy> but maybe it should be a new collection?
[19:10:08] <squeakytoy> hm,
[19:10:35] <tripflex> up to you
[19:10:37] <tripflex> i use mongoose though
[19:10:39] <tripflex> so i would use
[19:10:39] <tripflex> http://mongoosejs.com/docs/populate.html
[19:13:31] <squeakytoy> ok, thanks
[19:29:45] <Frnk> hey there!
[19:30:14] <Frnk> how can i do a self referencing query?
[19:30:17] <Frnk> like:
[19:30:49] <Frnk> > db.test.insert({ numbera: 12, numberb: 14 });
[19:30:52] <Frnk> > db.test.find({ numberb: { $ge: numbera }});
[19:32:06] <cheeser> you can use the aggregation framework to do that.
[19:32:06] <Frnk> error: numbera is undefined
[19:32:09] <Frnk> i want to compare to the very self documents 'numbera'
[19:32:13] <Frnk> ah
[19:33:14] <Frnk> ok, thanks... thats some starting point, i can work with... i'll figure this out
[19:55:56] <Frnk> ok, i dont know how aggrgate can help me for this:
[19:56:08] <Frnk> db.test.find({ loc: { $near: [40, 11], $maxDistance : radius } });
[19:56:29] <Frnk> where radius is part of the document
[19:56:56] <Frnk> like: db.test.insert( { loc: [48, 11], radius: 5 } )
[19:57:24] <Frnk> aggregate $match does not support $near ...
[20:00:43] <Frnk> I can do this with javascript, but that is a poor solution
[20:01:31] <joshua> Does this help http://docs.mongodb.org/manual/reference/operator/aggregation/geoNear/#pipe._S_geoNear
[20:03:16] <Frnk> haha, funny... that was exaclty the webpage i was looking at, THIS MOMENT
[20:04:26] <Frnk> its not all in there
[20:04:29] <Frnk> but i think I could calculate something like: difference = radius - calculatedDistance and then query for: difference > 0 or somethink loike that
[20:29:04] <Frnk> ok, i got it
[20:29:31] <Frnk> wanna see?
[20:30:00] <Frnk> db.test.aggregate([{ $geoNear: { near: [45, 11], distanceField: "distance" } }, {$project: { 'diff': { $subtract: ["$distance", "$radius"] } } }, { $match: { diff: { $gt: 0 } } }])
[20:30:23] <Frnk> great, isn't it?
[20:40:17] <cheeser> Frnk: nice :)
[21:19:51] <dxd828> Hey, something is trying to run "profile: -1" every few seconds as I can see in the logs. But the user keeps getting permission denied. What do i need to give that user so it can run this?
[21:41:42] <angasulino> I'm using the java driver to load an object from mongodb, it has a set_id(ObjectId) and ObjectId get_id(), but the ObjectId is not being loaded (I want to put the Id in some HTML so I can get it back when it's selected), I have searched but haven't come up with anything even related to my question, so I must be using the wrong terms, what am I doing wrong?
[21:42:18] <cheeser> without seeing your code... care to put it on a pastebin?
[21:44:05] <angasulino> http://pastebin.ca/2470027
[21:44:12] <angasulino> now looking for where I read it
[21:45:32] <angasulino> http://pastebin.ca/2470028
[21:45:41] <angasulino> cheeser, does that look like enough?
[21:46:31] <cheeser> doesn't that give you a class cast exception?
[21:47:32] <angasulino> no, it doesn't
[21:47:58] <angasulino> it works, just the _id in the class is not correct
[21:50:21] <cheeser> oh, i see. it's a basic reflective POJO mapper
[21:50:41] <angasulino> yes
[21:52:30] <angasulino> so, no idea why it wouldn't load the object id?
[21:53:32] <cheeser> well you're extending ReflectionDBObject which already has an _id...
[21:57:15] <angasulino> cheeser, thank you! I'm learning ant, spring, mongodb and jslt all at the same time, sometimes I make silly mistakes :-)
[21:57:31] <cheeser> no worries
[22:47:34] <LoneSoldier728> hey how do u name collections on the fly?
[22:48:05] <cheeser> what?
[22:48:29] <LoneSoldier728> ok
[22:48:32] <LoneSoldier728> sorry basically
[22:48:44] <LoneSoldier728> my db structure is going to be pretty nested
[22:48:56] <LoneSoldier728> I am using mongoose with nodejs to create models
[22:49:26] <LoneSoldier728> basically, I guess I want to name mongoose collections on the fly, I know they are specified in the model usually
[22:50:52] <LoneSoldier728> what makes more sense - basically these are the type of data I am going to store --- channel, week, year, songs - i was thinking of making a collection of channels, then within each channel have a collection of years, then in that a collection of weeks, and then a collection of songs within that
[22:51:03] <LoneSoldier728> or should I just make individual docs with fields for each of those
[22:51:27] <LoneSoldier728> I am assuming the individual docs would be better for querying/mongo ?
[22:52:36] <retran> i like the individual docs
[22:52:53] <retran> then if you need them in one collection, do a map-reduce as needed, or "join" them in app
[22:53:15] <retran> that's way better than one big nasty doc
[22:53:17] <LoneSoldier728> well I would be querying everything that has a specific channel, week and year
[22:53:41] <LoneSoldier728> so i would query mongo with those specific fields and asking for it to spit back what it got for me
[22:53:44] <LoneSoldier728> also, is there a ui available for mongodb with nodejs
[22:53:56] <retran> what would the UI have to do with nodejs
[22:54:05] <retran> there's a UI for mongo, of sorts
[22:54:23] <retran> it would work no matter what environment/language you use mongo with
[22:55:26] <LoneSoldier728> https://github.com/jedireza/drywall
[22:55:35] <LoneSoldier728> ive seen that but was wondering if anyone got an opinion
[22:56:09] <LoneSoldier728> well I was looking at ghenghis
[22:56:13] <LoneSoldier728> and it runs with php or
[22:56:16] <LoneSoldier728> ruby
[22:56:26] <LoneSoldier728> im looking to basically see my localhost db with it
[22:59:03] <tripflex> mongoose has populate
[22:59:16] <tripflex> https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCwQFjAA&url=http%3A%2F%2Fmongoosejs.com%2Fdocs%2Fpopulate.html&ei=CQNnUoOUEMP1kQfLjoDIBA&usg=AFQjCNHTC30cu9eYc298-HnXiM8E99-sNw&sig2=YWlGbOc__97Yw9c6bbjzyQ&bvm=bv.55123115,d.eW0
[22:59:19] <tripflex> haha whooops
[22:59:25] <tripflex> freaking google
[22:59:26] <tripflex> bleh
[22:59:31] <tripflex> http://mongoosejs.com/docs/populate.html
[22:59:51] <tripflex> that's one of the most annoying gripes i have with google
[23:01:25] <LoneSoldier728> what about that?
[23:02:02] <tripflex> LoneSoldier728: what is your operating system
[23:02:09] <LoneSoldier728> windows 8 baby
[23:02:16] <tripflex> yuck
[23:02:24] <LoneSoldier728> u used drywall?
[23:02:34] <tripflex> yup yup
[23:02:36] <tripflex> http://docs.mongodb.org/ecosystem/tools/administration-interfaces/
[23:02:47] <LoneSoldier728> u like it
[23:02:53] <tripflex> indeed
[23:03:15] <tripflex> BUT
[23:03:21] <tripflex> i dont like how the user accounts are setup
[23:03:25] <tripflex> i was going to fork my own
[23:03:26] <LoneSoldier728> what is the best
[23:03:27] <tripflex> but dont have time
[23:03:32] <LoneSoldier728> I just need to actually
[23:03:36] <LoneSoldier728> see the information
[23:03:45] <tripflex> what information? huh?
[23:03:45] <LoneSoldier728> and filter stuff if needed
[23:03:49] <LoneSoldier728> songs
[23:03:55] <LoneSoldier728> title, artist, date basically
[23:04:04] <tripflex> well you can do that client or server side
[23:04:25] <tripflex> if thats all you want
[23:04:30] <tripflex> then drywall isnt what you need
[23:04:51] <LoneSoldier728> oh whats the point of it then
[23:04:58] <LoneSoldier728> ya thats why i was confused when googling
[23:05:03] <LoneSoldier728> i want something basic that can see the info
[23:05:20] <tripflex> it's basically a "starter" for nodejs with admin, client, and frontend area
[23:05:25] <LoneSoldier728> and not have to do anything but specify my local host
[23:05:58] <LoneSoldier728> i saw ghenghis which I liked but it looks like it gets set up through
[23:06:01] <LoneSoldier728> php or ruby
[23:06:08] <tripflex> ruby
[23:06:10] <LoneSoldier728> im trying to just install thru an exe if possibly
[23:06:20] <tripflex> good luck :P
[23:06:22] <LoneSoldier728> or commandprompt and install
[23:06:24] <LoneSoldier728> or something
[23:06:33] <LoneSoldier728> not have to use a ruby shell
[23:06:35] <tripflex> look at that page
[23:06:37] <tripflex> http://docs.mongodb.org/ecosystem/tools/administration-interfaces/
[23:06:40] <tripflex> there's got to be windows clients
[23:07:18] <LoneSoldier728> like
[23:07:19] <LoneSoldier728> MMS
[23:07:21] <LoneSoldier728> the first one
[23:07:43] <LoneSoldier728> oh u got to pay
[23:08:08] <tripflex> keep going through them
[23:08:23] <LoneSoldier728> and installing drywall
[23:08:29] <LoneSoldier728> doesnt act in teh same way?
[23:09:12] <tripflex> https://github.com/pilwon/ultimate-seed
[23:09:15] <LoneSoldier728> if I wanted to use ghengis do i need to download ruby
[23:09:16] <tripflex> maybe i dont know
[23:09:20] <LoneSoldier728> shell
[23:09:23] <tripflex> i stripped out most of stuff i didnt need
[23:09:25] <tripflex> yes
[23:09:25] <LoneSoldier728> and then just run it from there and thats all
[23:09:27] <tripflex> i believe so
[23:09:42] <tripflex> you should probably just use virtualbox and setup a virtual machine
[23:09:44] <tripflex> with ubuntu
[23:09:47] <tripflex> and then install it on there
[23:10:31] <LoneSoldier728> never used ubuntu but heard of it...
[23:12:27] <LoneSoldier728> i can always implement
[23:12:36] <LoneSoldier728> the UI after the db has info already right
[23:21:29] <disorder> hi
[23:21:58] <disorder> I have a problem with this code:
[23:22:43] <disorder> I have a list of tags, and I want to check if every tag has attached a document, if not I want to delete that tag from its own collection
[23:22:53] <disorder> right now I'm using this, which is clearly wrong:
[23:22:56] <disorder> for (var i=0;i<tags.length;i++){
[23:22:56] <disorder> collection.findOne({'metadata.user_id': req.user._id,'metadata.tags':tags[i]},function(err,item){
[23:22:56] <disorder> if ((item==null) && (!err)) tags_coll.remove({'user_id': req.user._id,'name':tags[i]},function(){})
[23:22:56] <disorder> })
[23:22:56] <disorder> }
[23:23:14] <disorder> someone can help?
[23:23:51] <LoneSoldier728> is there a way to specify that a combination of fields must be unique
[23:30:52] <tripflex> dude ... google
[23:30:54] <tripflex> its your friend