PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Saturday the 21st of November, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[05:18:04] <Qweer> Hello is there a way to claim the ownership for one object? Like a lock. I have multiple resources which should be used by multiple nodes. However when one node is going down I want a timeout on this resource so another node can take over.
[05:31:13] <Boomtime> Qweer: not built-in, you can write such locking semantics yourself though
[05:32:39] <Qweer> @Boomtime I think 'findAndModify' is the one I'm looking for.
[05:46:39] <Boomtime> findAndModify or update will provide you with the atomic compare-and-swap instruction you need to build a distributed lock system
[05:47:18] <Boomtime> it does not lock the document persistently - it merely affects a change that will be atomic in nature
[05:48:20] <Boomtime> that is, so long as the field you update is part of the predicate (and will not match after the update succeeds) then any number of clients can race to perform such an update and only one will succeed
[13:52:01] <Waitak> G'day,all. I'm struggling a bit with the (new) C++ driver. I have an existing DB, created with the mongo shell. I can retrieve docs just fine using the shell, but when I try to issue exactly the same query from C++, nothing is returned. Any ideas?
[14:08:56] <erebel55> lo
[14:09:10] <erebel55> is mongoose still hip or is there something else?
[14:31:57] <cheeser> so ... many ... colons! *gasp*
[14:33:10] <erebel55> lol
[14:38:50] <erebel55> does anyone know how I could query for the number of votes per question? http://imgur.com/0tGRqyr
[15:00:31] <erebel55> would I use $size?
[15:12:58] <Petazz> Hi guys! Is there any way to make a conditional insert query? I'd like to generate a user a token lazily. My logic is simply, 1) query for the token for a user 2) if does not exist, generate one and insert
[15:13:39] <Petazz> I though of using update with upsert, but the problem is that I do not want to update the document if it does exist, then the query should do nothing
[15:14:06] <Petazz> So an atomic get_or_create with the get part being based on a query and not trying to catch the whole document
[15:16:02] <StephenLynx> I do believ there is something related to only doing something if the value does not exist, but I can`t remember the details.
[15:22:36] <erebel55> dang still can't figure it out
[15:39:57] <terabyte> does mongodb have a default user?
[15:40:01] <StephenLynx> no
[15:40:32] <terabyte> If I'm able to connect to mongodb, does that mean that I must have created a user?
[15:40:47] <terabyte> (and run queries etc)
[15:41:03] <terabyte> Sounds funny but I set this thing up somehow, but can't see where I specified the user...
[15:42:25] <terabyte> all I have is a db, host, port, but no user specified... is that normal?
[15:44:51] <terabyte> ok nevermind, i think it's complaining because i specified a username and password, that doesn't exist, if i just don't specify one, it connects fine
[15:59:40] <erebel55> okay, I figured out how to get the count of the choices array. But how would I get the count of all the votes?
[15:59:41] <erebel55> http://hastebin.com/cezahoyiso.bash
[15:59:46] <erebel55> http://imgur.com/0tGRqyr
[16:02:01] <terabyte> For this document, how would I perform a query for all documents with the partial id "user:12345"? { "_id" : { "userId" : "12345", "dIndex" : 19 }, ......}
[16:03:38] <terabyte> the document _id is composite, and I want to query for the userId portion
[16:05:26] <terabyte> nm, "_id.userid" works fine
[16:07:37] <erebel55> posted http://stackoverflow.com/questions/33845517/get-length-of-array-within-array-mongodb
[17:45:35] <erebel55> anyone know how I can get this to still return ones with 0 votes? http://hastebin.com/oxiquzacoj.js
[18:18:41] <guxi> Why doesn't .find() fetch any document, while .findOne(x) does return 1 as expected? http://i.imgur.com/tdMRcpO.png
[18:19:28] <cheeser> find() returns a cursor. findOne() returns a document.
[18:21:01] <guxi> Got it, thanks
[18:23:38] <cheeser> np
[20:32:03] <xargs> Public logging :(