PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Sunday the 3rd of August, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[04:23:52] <bo> hey
[05:57:59] <sellout> Is there any way to ask Mongo if the current user has a particular privilege? EG, if (db.user.hasPriv("anyAction", "anyResource") then db.eval(…) else db.slowerThing(…)
[08:09:21] <salty-horse> hi. using mongo 2.4.6 I dropped a sharded collection. while the collection doesn't appear when I run "show collections", typing "db.COLNAME.getShardDistribution()" shows the collection to be sharded and empty. how do I remove this metadata? I tried restarting all mognos and mongoconf. didn't help
[09:37:42] <Zelest> My mongodb.log is spammed with "connection accepted" and "end connection" all the time.. I was under the impression that MongoClient for PHP used persistant connections?
[09:37:49] <Zelest> I'm using php-fpm, 10 static forks
[09:39:44] <Zelest> Derick, *poke*
[10:42:07] <howdoi> is there a way to find document by ID, like 1 for the first document, 2 for the second and so on...
[10:42:13] <howdoi> new to _id thinge
[10:42:34] <howdoi> say I have a collection of books and I want the n'th book
[10:43:10] <howdoi> db.books.find({id:1}) wont fetch anything, as the document has no id attribute
[10:43:45] <Zelest> by default, it will sort by the natural order (the order it was inserted) ..
[10:43:53] <Zelest> use that in combination with skip() and limit() ?
[10:45:10] <howdoi> Zelest: trying that, but there no way to just fetch the required in a query, it's hard to do a db.books.find({_id:ObjectID(hash)})
[10:45:46] <Zelest> why is that hard?
[10:47:24] <howdoi> say it's web API, one does a GET on books/1
[10:47:33] <howdoi> that would give him the first book
[10:47:39] <howdoi> but books/hash
[10:47:44] <howdoi> how does one know that
[10:47:57] <howdoi> db.books.find({}).skip(5).limit(1), would give be the sixth on right?
[10:48:02] <Zelest> they get /books and get a list of all books? if it's truely REST ;)
[10:48:09] <Zelest> correct
[10:48:18] <Zelest> but yeah, I see your point..
[10:48:24] <Zelest> _id can be anything you want really
[10:48:33] <Zelest> nothing stops you from using a integer for it
[10:48:48] <Zelest> it's a bit tricky to make it auto-increment though and make it multithreaded.
[10:48:51] <howdoi> but default it has created some values in it
[10:49:00] <Zelest> yeah
[10:49:55] <howdoi> but if the query say get me the first book, I must do a db.books.find({}).skip(0).limit(1) :/ ?
[10:49:57] <Zelest> I dunno, I've never really had an issue with ObjectID hashes instead of integers as ID's
[10:50:26] <Zelest> or simply re-define _id
[10:50:28] <howdoi> say If i need to do a books/1 and using _id only, how can it be done?
[10:50:36] <Zelest> or sort on another field
[10:51:11] <desmondHume> maybe it'd be good to sort first
[10:51:40] <desmondHume> the "first" record always refers to the first result in a sorted query cursor
[10:52:32] <howdoi> db.books.find({}).skip(id-1).limit(1)
[10:52:57] <howdoi> where id is the rest param
[10:53:07] <Zelest> desmondHume, but what to sort on?
[10:53:25] <howdoi> zactly
[10:53:27] <Zelest> desmondHume, that would make book 5 be different books if you insert more things
[10:53:28] <desmondHume> That's up to howdoi
[10:53:59] <howdoi> :(
[10:54:52] <Zelest> howdoi, in short, use skip() and limit() if you want to go with the default behaviour of _id ... otherwise, define _id yourself as an integer for every book... or third, create another field, e.g, "bookid" which you use for your numeric id.
[10:55:03] <desmondHume> mongo has no default sort
[10:55:21] <Zelest> desmondHume, the default is the same order it was inserted in iirc.
[10:55:23] <desmondHume> it simply fetch the documents as they are in the files
[10:55:35] <Zelest> exactly
[10:55:47] <desmondHume> if you want to do like it's done in mysql
[10:55:49] <desmondHume> or sql in general
[10:55:54] <howdoi> hrrm
[10:56:04] <desmondHume> it migth be a good idea
[10:56:10] <desmondHume> to set a default sort order
[10:56:15] <desmondHume> on creation time
[10:56:29] <desmondHume> remember that mongo id's are generated using timestamp
[10:56:46] <desmondHume> to ensure incremental and unique value
[10:58:40] <desmondHume> I just read Zelest answer
[10:58:45] <desmondHume> it's a good idea to use skip and limit
[10:59:15] <desmondHume> and if you are building a rest api I'd keep the most common structure (:resource/:id)
[10:59:28] <howdoi> :)
[10:59:37] <desmondHume> and expose a more flexible interface on the "index" of the resource
[11:00:04] <desmondHume> like passing get parameters (offset, limit)
[11:00:16] <desmondHume> and simply proxying those parameters to mongo query
[11:00:52] <howdoi> thanks guys
[11:01:16] <desmondHume> (it's the first time for me on irc, i already love it)
[11:28:37] <howdoi> quick questions, hwo do you guys sahre the db?
[11:28:41] <howdoi> commint to the repo?
[11:28:42] <howdoi> ?
[11:29:22] <howdoi> mongoexport
[11:31:10] <howdoi> nice
[14:53:44] <munumnu> is there a way to use addToSet in the aggregation framework and count how often a unique value was added? It should look something like: [{addedVal: 2}, {addedVal2: 1},...]
[18:56:58] <Gargoyle> I'm evaluating whether to use EBS or Instance storage in AWS instances. Assuming everything is being deployed as 3 node replica sets what are the issues I'll face if an instance is completely killed and has to come back online with all local storage wiped out?
[19:40:08] <Derick> Zelest: pong
[21:54:04] <bo> hey guys
[21:54:08] <bo> i feel like i am missing something here
[21:54:19] <bo> cant seem to get mongo to work
[21:54:22] <bo> fork *
[21:54:54] <LouisT> are you running it as a daemon?
[21:55:52] <LouisT> i run mongod with something like: mongod --auth --fork --logpath $HOME/mongodb/logs/mong.log --pidfilepath $HOME/mongodb/mong.pid --logappend --directoryperdb --dbpath $HOME/mongodb/ --bind_ip 127.0.0.1
[21:56:06] <bo> oh im just doing service mongod start
[21:56:12] <bo> and using a config file
[21:56:20] <bo> is that any different than running the command
[21:56:24] <LouisT> you might be able to put the fork command within the config
[21:56:33] <bo> everytime i do it wont start
[21:56:37] <bo> and i cant seem to see any error in the log
[21:56:58] <LouisT> all i know of is --fork in the command line
[21:57:33] <LouisT> apparently you can put "fork = true" in the config
[21:57:52] <LouisT> http://docs.mongodb.org/manual/reference/configuration-options/#processManagement.fork
[21:57:53] <bo> i do and thats where i am having hte issue lol
[21:58:38] <LouisT> not sure, can you try it without service?
[22:00:09] <bo> i tried with the command
[22:00:17] <LouisT> still failed?
[22:00:20] <bo> bout to fork child process, waiting until server is ready for connections.
[22:00:20] <bo> forked process: 2174
[22:00:20] <bo> ERROR: child process failed, exited with error number 1
[22:00:22] <bo> yea
[22:00:31] <bo> no process running
[22:00:36] <bo> im only trying to do this
[22:00:37] <LouisT> and it only happens when you pass form?
[22:00:42] <LouisT> er, fork
[22:00:49] <bo> because i am reciveving a message about a memory leak
[22:00:55] <bo> beacuse mongo is not in production mode /
[22:00:59] <bo> am i missing something else?
[22:01:14] <LouisT> mmmmm i'm unaware, i've not had that issue
[22:01:18] <LouisT> how much memory is there?
[22:01:36] <bo> Warning: connection.session() MemoryStore is not
[22:01:37] <bo> designed for a production environment, as it will leak
[22:01:37] <bo> memory, and will not scale past a single process.
[22:01:42] <bo> i got 4 gigs free lol
[22:03:20] <LouisT> O_o
[22:04:01] <LouisT> is there a config option for memorystore or something?
[22:05:47] <LouisT> from what that says it seems as if you have a config option to store in memory only or something
[22:09:14] <LouisT> bo: i have no clue, i can't find anything in the docs about it, can you pastebin your config somewhere?
[22:13:34] <bo> sec
[22:15:52] <bo> http://pastebin.com/ewgH4qvr
[22:23:02] <bo> LouisT,
[22:23:36] <LouisT> huh
[22:23:46] <bo> you see the pastebin
[22:23:46] <LouisT> that's strange, i don't see anything abnormal
[22:24:15] <LouisT> and that error is from inside the mongodb log?
[22:28:03] <LouisT> bo: and it only happens when you attempt to fork?