[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?
[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: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?
[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