<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Getting Started With MongoDB (Python)</title>
	<atom:link href="http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/feed/" rel="self" type="application/rss+xml" />
	<link>http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/</link>
	<description>Ever wanted to build a browsergame?</description>
	<lastBuildDate>Wed, 30 Nov 2011 19:42:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Luke</title>
		<link>http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/comment-page-1/#comment-718</link>
		<dc:creator>Luke</dc:creator>
		<pubDate>Sun, 14 Feb 2010 00:58:03 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/#comment-718</guid>
		<description>I&#039;ve noticed this issue with some of my Bottle projects before, but I&#039;m not&lt;br&gt;exactly sure what&#039;s causing it - and it&#039;s been too intermittent for me to&lt;br&gt;reliably pin it down. I&#039;ll do some research and let you know if I find a&lt;br&gt;fix.</description>
		<content:encoded><![CDATA[<p>I&#39;ve noticed this issue with some of my Bottle projects before, but I&#39;m not<br />exactly sure what&#39;s causing it &#8211; and it&#39;s been too intermittent for me to<br />reliably pin it down. I&#39;ll do some research and let you know if I find a<br />fix.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/comment-page-1/#comment-717</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Sat, 13 Feb 2010 23:36:33 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/#comment-717</guid>
		<description>Strangely the redirect portion of /add-soldier/ doesn&#039;t work for me. In google chrome it directs&lt;br&gt;me to the link is broken page and firefox asks me if I want to resend POST data and then ends&lt;br&gt;up on an empty page. Not sure what I&#039;m doing wrong.</description>
		<content:encoded><![CDATA[<p>Strangely the redirect portion of /add-soldier/ doesn&#39;t work for me. In google chrome it directs<br />me to the link is broken page and firefox asks me if I want to resend POST data and then ends<br />up on an empty page. Not sure what I&#39;m doing wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke</title>
		<link>http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/comment-page-1/#comment-716</link>
		<dc:creator>Luke</dc:creator>
		<pubDate>Tue, 09 Feb 2010 21:04:05 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/#comment-716</guid>
		<description>Thanks for the heads-up, Mathias - I&#039;ll have to keep that in mind for&lt;br&gt;projects I write in the future.</description>
		<content:encoded><![CDATA[<p>Thanks for the heads-up, Mathias &#8211; I&#39;ll have to keep that in mind for<br />projects I write in the future.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mathias Stearn</title>
		<link>http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/comment-page-1/#comment-715</link>
		<dc:creator>Mathias Stearn</dc:creator>
		<pubDate>Tue, 09 Feb 2010 20:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/#comment-715</guid>
		<description>If you are using &#039;ip&#039; as the primary key to the users collection you may want to call it &#039;_id&#039;. Every object has an _id that is generated if you don&#039;t supply one. Also there is automatically a unique index on _id which will prevent you from creating two copies of the user.</description>
		<content:encoded><![CDATA[<p>If you are using &#39;ip&#39; as the primary key to the users collection you may want to call it &#39;_id&#39;. Every object has an _id that is generated if you don&#39;t supply one. Also there is automatically a unique index on _id which will prevent you from creating two copies of the user.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Luke</title>
		<link>http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/comment-page-1/#comment-713</link>
		<dc:creator>Luke</dc:creator>
		<pubDate>Mon, 08 Feb 2010 20:26:34 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/#comment-713</guid>
		<description>Hi Mike,&lt;br&gt;&lt;br&gt;Thanks for the heads-up - I knew about the upsert, but I didn&#039;t know&lt;br&gt;about the $push operation (or think to use it in my get_current_user&lt;br&gt;func). Thanks for the heads-up!</description>
		<content:encoded><![CDATA[<p>Hi Mike,</p>
<p>Thanks for the heads-up &#8211; I knew about the upsert, but I didn&#39;t know<br />about the $push operation (or think to use it in my get_current_user<br />func). Thanks for the heads-up!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Dirolf</title>
		<link>http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/comment-page-1/#comment-712</link>
		<dc:creator>Mike Dirolf</dc:creator>
		<pubDate>Mon, 08 Feb 2010 19:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://buildingbrowsergames.com/2010/02/08/getting-started-with-mongodb-python/#comment-712</guid>
		<description>Great post! You might want to take a look at some of the other atomic update modifiers that MongoDB provides. For example, the add-soldier view could be written something like this:&lt;br&gt;&lt;br&gt;def add_soldier():&lt;br&gt;    current_user = get_current_user()&lt;br&gt;    users.update(&lt;br&gt;        {&#039;ip&#039;: current_user[&#039;ip&#039;]},&lt;br&gt;        {&#039;$push&#039;: {&lt;br&gt;            &#039;army&#039;: random.choice(SOLDIER_NAMES),&lt;br&gt;        }}&lt;br&gt;    )&lt;br&gt;    redirect(&#039;/&#039;)&lt;br&gt;&lt;br&gt;Using $push will work even if the list doesn&#039;t exist to start with.&lt;br&gt;&lt;br&gt;You could get even more advanced by doing an upsert, eliminating the need to check if the user exists in get_current_user - just grab the IP and do the update posted above (with upsert=True added as a kwarg). That will be just a single fire-and-forget operation for the entire request.&lt;br&gt;&lt;br&gt;Anyway, already looks great as is - thanks for the post!</description>
		<content:encoded><![CDATA[<p>Great post! You might want to take a look at some of the other atomic update modifiers that MongoDB provides. For example, the add-soldier view could be written something like this:</p>
<p>def add_soldier():<br />    current_user = get_current_user()<br />    users.update(<br />        {&#39;ip&#39;: current_user[&#39;ip&#39;]},<br />        {&#39;$push&#39;: {<br />            &#39;army&#39;: random.choice(SOLDIER_NAMES),<br />        }}<br />    )<br />    redirect(&#39;/&#39;)</p>
<p>Using $push will work even if the list doesn&#39;t exist to start with.</p>
<p>You could get even more advanced by doing an upsert, eliminating the need to check if the user exists in get_current_user &#8211; just grab the IP and do the update posted above (with upsert=True added as a kwarg). That will be just a single fire-and-forget operation for the entire request.</p>
<p>Anyway, already looks great as is &#8211; thanks for the post!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

