PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Wednesday the 3rd of June, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:00:09] <viritt> I mean the _id of a config
[00:00:22] <joannac> you can't?
[00:00:27] <joannac> _id is immutable
[00:00:31] <viritt> hum, ok
[00:01:13] <joannac> why do you want to change it?
[00:03:04] <viritt> there was a mismatch of configs between mongod and mongod.conf
[00:03:09] <viritt> somehow :x
[00:03:33] <viritt> like, not the correct path of DB, not the correct replSet running,
[02:02:04] <redsand> question, using the php driver (1.6.x) how can I use the aggregate command against a collection AND ALSO request partial results?
[02:02:09] <redsand> I can only specify this via MongoCursor object with the function call ->partial(true)
[03:10:34] <daidoji> redsand: what do you mean?
[03:10:50] <daidoji> redsand: $limit maybe?
[03:11:09] <daidoji> http://docs.mongodb.org/manual/reference/operator/aggregation/limit/
[03:17:08] <redsand> daidoji: what? no
[03:17:12] <redsand> partial results
[03:17:15] <redsand> for sharded queries
[03:17:21] <redsand> not $limit
[03:17:27] <redsand> $limit is for limiting results
[03:17:42] <redsand> I want my aggregate queries to return when only part of the shard grid is available
[03:17:59] <redsand> does that make sense/
[03:18:00] <redsand> ?
[03:29:37] <daidoji> redsand: oh I see. Yeah, I don't know much about that
[06:12:08] <someone235> Hi, what is the best way to reference to a sub-document?
[06:23:02] <joannac> someone235: don't. otherwise, via some identifying field?
[10:20:56] <koren> I'm trying to fetch a subdocument contained in an array contained in a subdocument
[10:21:12] <koren> without getting the whole document, only the subdocument is usefull for me
[10:21:24] <koren> I tried to do multiple unwind but failed
[10:22:18] <koren> ie I did: { $unwind: '$views' } beacause views is an array but I don't know how to then unwind an array inside views
[10:22:33] <koren> I have to $project first?
[10:22:40] <koren> or $group? I'm lost
[11:12:45] <luaboy> how do I resolve the duplicate key error ?
[12:09:50] <Folkol> Chosing another key, removing the old one or upsert instead of insert..
[12:09:59] <Folkol> Depending on what you want to achieve.
[12:10:27] <Folkol> (upsert = update, but insert if missing. See: http://docs.mongodb.org/manual/reference/method/db.collection.update/)
[12:10:31] <Folkol> @luaboy
[12:40:12] <crised_> I have an app, that would need only geospatial calculations, no documents at all, is it a good idea to use mongo?
[12:40:48] <compeman> crised_ what will be commonly used, write or read?
[12:41:13] <crised_> compeman: write most of the time
[12:41:25] <crised_> compeman: need queries like inclusion if location is contained within a polygon
[12:42:51] <compeman> crised_ MongoDB can query for locations contained entirely within a specified polygon. Inclusion queries use the $geoWithin operator.
[12:43:15] <compeman> MongoDB can query for the points nearest to another point. Proximity queries use the $near operator. The $near operator requires a 2d or 2dsphere index.
[12:43:36] <crised_> compeman: My point is: Is it a good idea to use Mongo only for this purpose? Shouldn't Mongo be used for Document Storage?
[12:44:42] <compeman> crised_ i cannot compare other dbs to mongo for your purpose, but if i were you, i would prefer mongodb
[12:44:58] <compeman> someone may help you better
[12:45:16] <compeman> mongo has good builtin geolocation functions
[12:47:29] <crised_> compeman: ok
[13:07:39] <ams__> I have multiple, distinct documents I want to update. Is it possible to do this in single command in mongodb? The bulk update functions seem to be for applying an update to many documents, as opposed to applying 1 update to 1 document at a time
[13:12:27] <deathanchor> ams__: are you doing the same update to all or different changes to each?
[13:14:21] <ams__> deathanchor: different changes to each
[13:15:03] <deathanchor> nope, you have to do separate updates to each as far as I know.
[13:22:42] <cheeser> you can do bulk write update with some drivers.
[13:22:58] <cheeser> iirc, all the new drivers should support that.
[13:23:54] <deathanchor> cheeser: what is the pymongo function for that?
[13:24:38] <deathanchor> nevermind I found it
[13:27:00] <mbeacom> Good morning!
[13:27:07] <FatNoLife> hi
[13:27:48] <ams__> deathanchor: what is the function? :-)
[13:30:17] <deathanchor> ams__: http://api.mongodb.org/python/current/examples/bulk.html
[13:31:10] <ams__> deathanchor: but that appears to be for applying the same update to multiple documents?
[13:31:46] <ams__> deathanchor: oh! I see, I make multiple calls and then execute in one go
[13:31:59] <deathanchor> yeah I didn't know about that either
[13:34:09] <deathanchor> ugh... I really need to upgrade my main DBs up to 2.6
[13:36:04] <cheeser> or 3.0.3
[13:36:29] <deathanchor> 2.2 sucks for feature sets.
[13:38:30] <mbeacom> Can someone take a look at my data model/structure (mongo 2.6) and the query I am attempting to use (Aggregation)? http://pastebin.com/xDxjCahb and http://pastebin.com/cepMuHcS
[13:39:36] <mbeacom> Is it possible to return full documents of all documents matching the ending criteria of my query? In it's original structure and distinct, that is?
[13:43:15] <mbeacom> I am still trying to get acquainted with MongoDB :(
[13:43:54] <deathanchor> mbeacom: that is a complex problem. sorry can't help
[13:46:07] <joannac> mbeacom: ?
[13:48:18] <joannac> your question doesn't make sense
[13:49:08] <joannac> an example of what you want would help
[14:01:51] <deathanchor> is there a way to duplicate or clone a DB? (dup of db with collections and docs)
[14:02:35] <deathanchor> oo... copyDatabase()
[14:03:45] <deathanchor> perfect for backingup and testing my code :)
[14:25:13] <someone235> Is there a way to load mongoose model instance from db? something like post = new Post({id:5})?
[14:38:07] <StephenLynx> someone235 using mongoose is unadvised.
[14:38:20] <someone235> StephenLynx, why?
[14:38:33] <StephenLynx> first, it is slow.
[14:38:42] <StephenLynx> second, it handles _id in a very weird way.
[14:38:51] <StephenLynx> and is bad software in general.
[14:39:38] <StephenLynx> almost every time someone shows up with issues in node/io, it is because of mongoose.
[14:39:57] <someone235> StephenLynx, What package do you use instead?
[14:40:03] <someone235> StephenLynx, the native?
[14:40:06] <StephenLynx> just the regular driver.
[14:43:49] <someone235> StephenLynx, do you familiar with a good documentation of the native drive? because I saw it's not exactly the same, e.g you must use updateOne\Many instead of just update
[14:44:11] <StephenLynx> http://mongodb.github.io/node-mongodb-native/2.0/
[14:45:34] <someone235> StephenLynx, why it tells me to use the deprecated method "update"?
[14:45:48] <StephenLynx> update deprecated?
[14:46:05] <StephenLynx> by no means update is deprecated. where did you saw it?
[14:46:32] <StephenLynx> "use updateOne, updateMany or bulkWrite"
[14:46:35] <StephenLynx> well, fancy that.
[14:46:37] <StephenLynx> :v
[14:47:23] <StephenLynx> it actually tells you to not use it, uh.
[14:50:38] <pamp> anyone with problems to send iostat_ios to mms?
[14:50:56] <mtree> hello guys, i have aggregate query like this: http://jsfiddle.net/d83j3910/
[14:51:07] <marcusahle> Hello.
[14:51:19] <pamp> when I fetch iostat_ios in telnet I get bad exit
[14:51:35] <pamp> cpu and iostat work well
[14:51:36] <StephenLynx> mtree, just use 1
[14:51:42] <StephenLynx> instead of '$fieldName'
[14:51:51] <StephenLynx> if you just want to output the field as it is.
[14:52:20] <mtree> StephenLynx: thanks for the tip! but that wasnt my question, give me a second to describe it properly
[14:52:53] <marcusahle> I’m attempting to put a file via GridFS after enabling authorization/authetnication. I gave write privilege to fs.files and fs.chunks but I am getting the following error “Not authorized to execute command {filemd5: ObjectId(‘XXXX’), root: “fs”}
[14:53:30] <StephenLynx> try giving the privilege just at "fs"
[14:55:00] <mtree> http://jsfiddle.net/d83j3910/1/ (updated fiddle) <- as a result i get multiple objects. Some of them contain same "cachedAt" string. I'd like to group them by cachedAt but for otaPrice field I'd like to get the lowest value of all records with the same cachedAt. How can I do this?
[14:57:11] <StephenLynx> $group{_id:'$cachedAt'} to group by cachedAt
[14:57:33] <StephenLynx> read on the $group operators
[14:57:47] <StephenLynx> you can get just the lowest value on a field
[14:58:03] <StephenLynx> and push whole documents on a subarray
[14:58:31] <mtree> StephenLynx: thanks!
[15:05:17] <mbeacom> Sorry for my delayed response... But, I am attempting to query a collection of data: 'messages' which is structured like this: http://pastebin.com/r6qRPqXK in Python and I am constructing the mongodb query like so: http://pastebin.com/0bUWxCQV | In the first query, I am not grouping or projecting, so it returns duplicates/non-distinct entries. When I group and project like demonstrated in the second query,
[15:05:18] <mbeacom> I receive _id: thread_id for all of the distinct thread_ids that matched the query criteria.
[15:07:02] <mbeacom> I am attempting to receive the data back, such that it's distinct, but maintains the original data structure (specifically, I am attempting to retain the recipient_ids from the document level, while matching against the subdocument fields and grouping them accordingly, while maintaining the 'recipient_ids'
[15:45:11] <yauh> Anyone here familiar with geospatial queries?
[15:45:22] <yauh> I need to find all LineStrings $near a point
[15:45:41] <yauh> Unfortunately neither of the geospatial operators in Mongo 3.0.2 seems to return a LineString object
[15:45:48] <marcusahle> Anyone know why there is no privilege action for filemd5?
[15:56:28] <yauh> Actually I'd prefer a way to find all linestrings that cross through a polygon - if that is easier ;)
[16:05:13] <pamp> Hi
[16:05:32] <pamp> problem with iostat_ios munin node
[16:05:45] <pamp> I've cpu and iostat statistics working
[16:05:49] <jr3> I have two databases hosted by a mongo server, db1 and db2, based on a selection on the client side one of these two will be hit, how should I handle this on my backend? do I basically open and close a connection to mongo on each request
[16:06:01] <pamp> but iostat_ios doesn t
[16:06:12] <jr3> OR do I open them both at app start and pass the connection into mongoose through some kind of abstraction layer
[16:06:25] <pamp> someone had the same problem?
[16:08:48] <pamp> the output in the logs: http://prntscr.com/7coq3o
[16:18:53] <brotatochip> Can anybody help me figure out why I'm seeing this happen during initial sync of my replica set?: "initial sync exception: 13106 nextSafe(): { $err: \"assertion src/mongo/db/storage/extent_manager.cpp:109\" } 9 attempts remaining"
[16:19:36] <brotatochip> here's a pastebin of my config, rs.status() and the mongodb log http://pastebin.com/p7T4zZ5F
[16:32:09] <JokesOnYou77> Hi all. Is it possible to use $each in an aggregation pipeline? I have two fields that I would like to add to the same field in a $group action.
[17:20:40] <_ari> if i have dates that are in my collection like this "2015-05-20 00:00:00"
[17:20:59] <_ari> ifi want a duration
[17:21:11] <_ari> can i do $gte and $lte?
[17:21:38] <_ari> on a string date?
[17:23:00] <deathanchor> _ari: no.
[17:23:17] <deathanchor> this is why you should use Date() formats in your db
[17:25:13] <_ari> hmmm
[17:25:32] <_ari> do i format those dates before inserting it into the db?
[17:26:16] <StephenLynx> no need
[17:26:23] <StephenLynx> just regular date objects.
[17:26:26] <deathanchor> how are you inserting them? most drivers take the Date format of a native code language and insert it to Mongo correctly
[17:32:11] <_ari> deathanchor: i'm inserting data from a parsed csv file
[17:48:46] <_ari> hmm
[18:22:06] <brotatochip> does anyone know if you can specify master/slave in /etc/mongod.conf?
[18:22:17] <brotatochip> for mongodb version 2.6
[18:22:50] <brotatochip> I'm not finding anything in the docs
[18:22:51] <StephenLynx> afaik mongo doesn't use master/slave for a while now.
[18:23:03] <brotatochip> according to the documentation, it does
[18:23:05] <StephenLynx> it has been changed to a different system
[18:23:16] <StephenLynx> replica shard or something
[18:23:23] <StephenLynx> but I have never used so I am not sure.
[18:23:26] <brotatochip> http://docs.mongodb.org/v2.6/core/master-slave/
[18:23:32] <StephenLynx> yeah, that is old.
[18:23:35] <StephenLynx> really old.
[18:23:50] <brotatochip> is this one really old too? http://docs.mongodb.org/manual/core/master-slave/
[18:24:14] <StephenLynx> Important Replica sets replace master-slave replication for most use cases. If possible, use replica sets rather than master-slave replication for all new production deployments. This documentation remains to support legacy deployments and for archival purposes only.
[18:24:23] <StephenLynx> literally the very first thing in the page.
[18:24:31] <brotatochip> And?
[18:24:35] <StephenLynx> yeah, w/e
[18:24:41] <brotatochip> I've not been successful at using replica sets to accomplish this
[18:25:20] <brotatochip> I've been in here 2 days asking for help and not getting it so I created a jira ticket, but this is a blocker for production and my boss is on my ass to get this completed
[18:25:52] <StephenLynx> have you tried using 3.0?
[18:26:22] <StephenLynx> and if you are in a hurry for support, maybe you should consider paying for it.
[18:28:42] <JokesOnYou77> Is it possible to use $each in an aggregation pipeline? I have two fields that I would like to add to the same field in a $group action.
[18:29:25] <brotatochip> StephenLynx: any sys admin worth a shit would never run something as new as mongodb 3.0 in prod
[18:29:32] <StephenLynx> :^)
[18:29:35] <StephenLynx> okey dokey then.
[18:29:36] <brotatochip> no offense
[18:30:00] <StephenLynx> surely running deprecated software is much better.
[18:30:07] <StephenLynx> surely you have done your research.
[18:30:28] <StephenLynx> and is up to date with mongo's internal workings and current state of development.
[18:31:58] <StephenLynx> surely you just didn't check the release date and said "yeah, nah, its unstable"
[18:34:55] <brotatochip> no StephenLynx, I did not, however, I don't run software that hasn't been out and tested for a minimum of 6 months in production, and any sys admin that does is taking a risk
[18:35:14] <StephenLynx> and what are your metrics for 6 months?
[18:35:27] <brotatochip> and 2.6.8 or 2.6.10 is not legacy software...
[18:35:54] <StephenLynx> of course, 10gen didn't meant 'legacy' when they wrote LEGACY in the big ass yellow box.
[18:36:31] <StephenLynx> again, w/e. keep bashing your head with deprecated software. is not my job, not my boss and not my servers.
[18:36:45] <brotatochip> it's a configuration option, and I've attempted to follow it using replica sets, but this produces a bug on the initial sync, I'm open to other configuration options if they will work better
[18:36:58] <brotatochip> or if they will work at all
[18:38:00] <brotatochip> however suggesting that I switch to the latest edition of a piece of software that hasn't been put through its paces in terms of time in the wild, that's something most seasoned sys admins would not be comfortable doing
[18:39:53] <brotatochip> and for good reason, I might add, do you remember all the negative press MongoDB was getting about a year ago regarding records becoming corrupted StephenLynx ?
[18:41:09] <brotatochip> in my line of work you don't take unnecessary risks that could compromise your system stability in any way. I'm not saying mongodb 3.0 is not stable, I'm just saying I won't be one of the admins out there that assumes that risk
[18:53:49] <arussel> is mongorestore bright enough to resume a restore after an interruption ?
[20:18:44] <jr3> I need to separate out databases by region, so a database for NA and a database for EU is this common?
[20:18:59] <jr3> or could I just simply put a region as apart of my models
[20:19:08] <StephenLynx> I would suggest that.
[20:19:17] <jr3> the latter?
[20:19:20] <StephenLynx> yes.
[20:19:31] <StephenLynx> other wise you would require separate connections
[20:19:56] <StephenLynx> and performing anything cross-region would be a major pain in the ass.
[20:20:31] <jr3> yea, so right now if I add region to my models its going to require me to go back and consider all my queries and modify some constraints
[20:21:03] <jr3> eg., a collection right now has a unique name property, but now the uniqueness would be name + region
[20:21:23] <GothAlice> jr3: As a note, MongoDB has what is referred to as "datacenter aware replication and sharding". For example, if you have servers in each region you can instruct queries within that region to prefer the local secondaries. In a similar way, you could, in theory, distribute shards (subsets of the data) between different DCs based on the sharding key, which would reference a field on the records to identify which DC to put the record in.
[20:22:00] <GothAlice> Ref: http://docs.mongodb.org/manual/data-center-awareness/
[20:22:42] <GothAlice> This has the important distinction of continuing to allow you to query data across DCs without having to "join" together multiple collections' worth of results application-side. (The mongos routers handle that for you.)
[20:36:54] <mbeacom> Does anyone happen to know if I can 'match' subdocument items with toplevel field values? i.e.: latest: 1433111111111 filtering out any subdocuments from an 'unwind' of 'messages' where I would exclude any results where 'latest' (toplevel) doesn't match 'messages.timestamp' ?
[20:42:02] <GothAlice> mbeacom: A $match stage after the unwind with an $eq comparison between the two fields might work.
[20:43:43] <GothAlice> mbeacom: Ref: http://docs.mongodb.org/manual/reference/operator/aggregation/eq/ a la {$project: {is_latest: {$eq: ["$latest", "$messages.timestamp"]}}}, {$match: {is_latest: true}}
[20:44:07] <mbeacom> GothAlice: Thank you for your response! Much appreciated!
[20:44:19] <GothAlice> It never hurts to help. :)
[20:54:42] <nofxx_> So, is everybody using wiredtiger now? Doing new stuff, wondering when to move my old stuff...
[20:55:00] <StephenLynx> nope.
[20:55:05] <StephenLynx> not until its the default.
[20:55:19] <StephenLynx> I would move when it becomes the default.
[21:03:30] <GothAlice> nofxx_: There remain some serious outstanding issues, including memory use limits not being followed and resulting crashes, data loss, etc.
[21:04:05] <GothAlice> I use it in development for general development work, but I have buckets of RAM to throw at it, and tiny development datasets. On our production data we can reliably kill a mongod running WiredTiger, unfortunately.
[21:06:13] <nofxx_> Thanks! Woa, from the ads they sell it's the 8th marvel of the world
[21:06:42] <GothAlice> jr3: http://blog.mongodb.org/post/101859068708/four-ways-to-optimize-your-cluster-with-tag-aware < this trickled out of my search, might be a lighter introduction to the sharding concepts.
[21:06:46] <nofxx_> like tokumx too... hehe. Think we'll see em more now that percona bought the fractal thing?
[21:07:20] <GothAlice> Well, WT is really neat. And it does a lot of things really well. There's just bugs to iron out. :)
[21:10:04] <GothAlice> nofxx_: TokuMX is one of those things, like a MasterCard Black (or whatever it's called). Those that need what it provides tend to know about it. Considering the tuning for ultra-mega-super-enterprise datasets, it's probably not a bad thing. Hiding it a little helps reduce user confusion when first introducing them to MongoDB.
[21:10:37] <GothAlice> "Which should I use?" typically indicates one does not need TokuMX. ;P
[21:11:06] <Derick> GothAlice: with it becoming default in 3.2, that ironing seems likely
[21:11:23] <GothAlice> Derick: Indeed. Pretty swift progress on the tickets I'm monitoring.
[21:12:00] <Derick> GothAlice: glad to hear :)
[21:12:03] <GothAlice> Though way too many are stuck in "waiting for user feedback" that never comes around. XP
[21:12:19] <Derick> are you not the user?
[21:12:33] <Derick> oh - I guess they mean original reporter
[21:12:33] <GothAlice> … let's just say, I wasn't unique in the issues I encountered.
[21:12:35] <GothAlice> Aye.
[21:29:06] <JokesOnYou77> Can I combine two array fields with $project?
[21:37:43] <cheeser> JokesOnYou77: no
[21:38:50] <redsand> GothAlice: we have same experience
[21:39:03] <redsand> WT in production was a business need for the compression
[21:39:15] <redsand> but just traded 1 bag of problems for another
[21:41:59] <Jacoby6000> how do you do a diff on two bson files from a dump?
[21:46:29] <JokesOnYou77> cheeser, thanks.
[22:42:00] <brotatochip> Can anyone give me a reason against creating a 2 member replica set with one member priority 1 and the secondary priority 0?
[23:28:40] <Boomtime> brotatochip: consider that if you lose the second machine (the priority zero one) through hardware failure or whatever, the primary will step down
[23:29:52] <Boomtime> if you want to create a two member set where the second member is basically just acting as a second copy of data (and not availble to be the primary), you should probably remove the vote it has in elections
[23:30:41] <Boomtime> such a setup means you have a single instance for all operations, but the data is being replicated to a second location
[23:58:56] <brotatochip> Boomtime: sorry, I left out the fact that the secondary is also a non voting member, so the primary is the only voter
[23:59:55] <brotatochip> Boomtime that is fine for now, we just need a second instance to give us fault tolerance in the case of an outage