PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Saturday the 3rd of May, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:00:29] <frodo_baggins> I searched for WriteResult in this repository and found nothing: https://github.com/mongodb/node-mongodb-native/search?q=writeresult&ref=cmdform
[00:02:44] <frodo_baggins> I guess for now... I can infer from the document result whether an insert or an update was performed.
[00:03:40] <ranman> is an _id returned on an update?
[00:03:53] <ranman> frodo_baggins: sorry I'm not super familiar with the node driver
[00:04:10] <frodo_baggins> I'm pretty sure the whole document is returned.
[00:04:27] <frodo_baggins> Unless the fields option is specified.
[00:04:45] <frodo_baggins> But, from what I've gathered, node-mongodb-native does not support WriteResult.
[00:05:36] <frodo_baggins> And it looks like nobody has opened an issue on the GitHub repo.
[00:06:16] <frodo_baggins> Because they do not have an issue tracker for this project. Neat.
[00:07:33] <frodo_baggins> Oh, they use JIRA.
[00:19:13] <frodo_baggins> Wow, this is confusing.
[00:19:25] <frodo_baggins> http://docs.mongodb.org/manual/reference/method/db.collection.findAndModify/#return-new-document
[00:19:44] <frodo_baggins> "... if no matching document exists, inserts a document and returns the newly inserted document in the value field."
[00:20:09] <frodo_baggins> What value field?
[01:11:22] <frodo_baggins> Is there something like... db.collection.first()?
[01:12:07] <frodo_baggins> hmm, db.collection.find() with no arguments seems to do the trick.
[02:04:55] <cheeser> frodo_baggins: findOne()
[02:05:25] <frodo_baggins> Hmm, find() seems to work okay.
[02:06:40] <cheeser> find() returns a cursor
[02:07:01] <cheeser> findOne() returns a document
[02:09:49] <frodo_baggins> Okay, I'll use findOne. :D
[11:36:05] <Dynetrekk> hi, how do I append to a list in a mongodb document? (i.e. retrieve document, append to list, re-save/update/whatever)
[11:54:21] <Nodex> $set
[11:54:33] <Nodex> or do you mean an array?
[12:00:56] <Dynetrekk> Nodex: append to an array, yes
[12:01:02] <Dynetrekk> Nodex: I'll paste my schema
[12:01:44] <Dynetrekk> Nodex: https://gist.github.com/Dynetrekk/fd1000e02655a9c0d0f7
[12:01:53] <Dynetrekk> I'd like to append price date/value pairs
[12:02:42] <Dynetrekk> Nodex: actually, I'd like to Product.findOne(..); if no object exists, create it; if one exists, update the price array
[12:02:47] <Dynetrekk> by pushing an element to its end
[12:12:13] <Nodex> you can't do that in one query if I'm reading your question correctly
[12:12:30] <Nodex> adding to an array is done with $addToSet
[12:13:27] <Dynetrekk> Nodex: I don't mind if I have to make 2 queries
[12:13:31] <Dynetrekk> (mongoose on node.js btw)
[12:20:20] <Nodex> tbh $addToSet will update anyway
[12:20:39] <Nodex> but is your price array meant to be an object or an array?
[12:20:53] <Nodex> i/e is it meant to have multiple prices in it?
[12:27:12] <Dynetrekk> Nodex: multiple prices. history tracking
[12:27:30] <Dynetrekk> it's a hobby project for tracking prices of a web store
[12:27:44] <Nodex> then $addToSet will suffice
[12:28:07] <Nodex> it will add the object ONLY if it doens't already exist
[12:28:10] <Dynetrekk> Nodex: will have a look at the docs! thanks
[12:28:22] <Nodex> and you can do it all in one operation
[12:28:43] <Nodex> else $push will add the object to the array
[12:29:23] <Dynetrekk> Nod
[12:53:06] <vincent123> hello everyone, is there a way to delete an entry from the oplog?
[14:42:06] <sivli> Morning/good day all, anyone on?
[14:48:11] <sivli> Well in case anyone is avalible. I am looking for an existing patern for a very simple triple store in mongo.
[14:48:50] <sivli> Or a equivalent graph patern would work.
[18:17:18] <sivli> Hey all, anyone on?
[18:17:37] <saml_> yes
[18:17:42] <saml_> i was waiting for you
[18:18:09] <sivli> :) awesome. I have a rather silly ‘schema’ question
[18:19:02] <saml_> i'm schema master
[18:19:03] <sivli> I posted it here http://stackoverflow.com/questions/23434697/relationship-mapping-in-mongodb but basically how should I build a triple/graph with mongo?
[18:19:17] <saml_> oh no. i say don't
[18:19:37] <saml_> use mongodb as denormalized cache your application needs
[18:20:09] <saml_> i tried hard to make "joins" or relationships work. it just isn't built for that
[18:20:09] <sivli> Thats what I was getting but I really need paths. And I am running in Meteor JS so I am more or less locked to pure Mongo.
[18:20:17] <sivli> Yeah…
[18:20:26] <saml_> let me actually comprehed your SO question
[18:21:35] <saml_> is scene a document?
[18:22:00] <sivli> Ah is that what is making it confustin yes both the game and scenes are docs
[18:22:28] <sivli> Sorry collections to be more accurate
[18:22:31] <saml_> is x variable?
[18:22:36] <sivli> each scene is a doc
[18:22:38] <saml_> x steps from current scene
[18:22:39] <sivli> yes
[18:22:50] <saml_> so you can't just cache 5 steps
[18:23:01] <saml_> since x can be dynamic per user, game session, .... etc
[18:23:40] <sivli> Its got more to do with the client. iPad vs full desktop. How much memory does it have.
[18:24:00] <sivli> And cache as much as is reasonable
[18:24:51] <saml_> maybe make a document representing a game , containing all scenes in a single doc
[18:25:08] <saml_> and client caches entire game. and calculates next available scenes
[18:25:37] <saml_> GET /games/1 gets all scenes in the game 1. and client builds the scenes... etc
[18:26:04] <sivli> Thats more or less what I am starting to do. That does not sound to crazy then?
[18:26:39] <sivli> Once I commit to this changing the model will be a lot of work. Just want to be sure this is the best option.
[18:31:52] <sivli> Hmm reviewing my current build I think you are right. I am going to merge Games and Scenes. I already have the data heavy aspects of scenes extracted into a Segment collection (doc).
[18:34:06] <sivli> Ah well so much for preventing cheating. (not a real issue as its one player) Thanks, always great to have a second option!
[19:41:08] <simpleAJ> could some explain me how does dataSize and storageSize related to each other.
[19:41:10] <simpleAJ> http://pastebin.com/Z4YPygGq
[19:41:39] <simpleAJ> that is my small experiment.. i am not able to understand when does exactly mongodb decides to add more storage for the collection
[20:35:02] <evotuned> anyone around? got a quick sharing question
[20:35:28] <evotuned> do i have to drop all current indexes in order to shard?
[21:22:22] <joannac> evotuned: nope. why do you think that?