<?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: MongoDB Gotchas</title>
	<atom:link href="http://www.vancelucas.com/blog/mongodb-gotchas/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vancelucas.com/blog/mongodb-gotchas/</link>
	<description>Web Entrepreneur and Freelance PHP/Javascript Developer</description>
	<lastBuildDate>Sat, 14 Jan 2012 15:22:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Delicious Bookmarks for July 27th from 14:50 to 15:23 &#171; Lâmôlabs</title>
		<link>http://www.vancelucas.com/blog/mongodb-gotchas/comment-page-1/#comment-860</link>
		<dc:creator>Delicious Bookmarks for July 27th from 14:50 to 15:23 &#171; Lâmôlabs</dc:creator>
		<pubDate>Tue, 27 Jul 2010 20:01:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.vancelucas.com/?p=562#comment-860</guid>
		<description>[...] MongoDB Gotchas &#124; Vance Lucas &#8211; July 27th  %(postalicious-tags)( tags: mongodb nosql database development advice tips programming mongo )% [...]</description>
		<content:encoded><![CDATA[<p>[...] MongoDB Gotchas | Vance Lucas &#8211; July 27th  %(postalicious-tags)( tags: mongodb nosql database development advice tips programming mongo )% [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mark mcdonald</title>
		<link>http://www.vancelucas.com/blog/mongodb-gotchas/comment-page-1/#comment-848</link>
		<dc:creator>mark mcdonald</dc:creator>
		<pubDate>Sun, 25 Jul 2010 19:39:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.vancelucas.com/?p=562#comment-848</guid>
		<description>It might help to speed this regex up if you add an &#039;o&#039; at the end like such:

db.test.find({&#039;tags&#039;: /jquery/io});

which is a flag to compile this regex once.
 

Stuff like this works in Perl and I think in Ruby&#039;s regex lib... 

MongoDB&#039;s regex lib is javascript right? Really not sure if that works or not in js. or maybe compile it ahead of time using  RegExp::compile</description>
		<content:encoded><![CDATA[<p>It might help to speed this regex up if you add an &#8216;o&#8217; at the end like such:</p>
<p>db.test.find({&#8216;tags&#8217;: /jquery/io});</p>
<p>which is a flag to compile this regex once.</p>
<p>Stuff like this works in Perl and I think in Ruby&#8217;s regex lib&#8230; </p>
<p>MongoDB&#8217;s regex lib is javascript right? Really not sure if that works or not in js. or maybe compile it ahead of time using  RegExp::compile</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan Migliorisi</title>
		<link>http://www.vancelucas.com/blog/mongodb-gotchas/comment-page-1/#comment-769</link>
		<dc:creator>Bryan Migliorisi</dc:creator>
		<pubDate>Thu, 08 Jul 2010 20:01:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.vancelucas.com/?p=562#comment-769</guid>
		<description>@Vance Lucas

You see, to me, it feels like the &quot;gotcha&quot; is in MySql, not MongoDB.  

Being able to query by a number as well as by the numbers string representation feels like a strange thing.

In the rigid and strict world of traditional RDBMS, you wouldnt expect the engine to just take either data type (or is it just me??).

As @kk points out, this is specifically a MySql &quot;feature&quot;</description>
		<content:encoded><![CDATA[<p>@Vance Lucas</p>
<p>You see, to me, it feels like the &#8220;gotcha&#8221; is in MySql, not MongoDB.  </p>
<p>Being able to query by a number as well as by the numbers string representation feels like a strange thing.</p>
<p>In the rigid and strict world of traditional RDBMS, you wouldnt expect the engine to just take either data type (or is it just me??).</p>
<p>As @kk points out, this is specifically a MySql &#8220;feature&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kk</title>
		<link>http://www.vancelucas.com/blog/mongodb-gotchas/comment-page-1/#comment-766</link>
		<dc:creator>kk</dc:creator>
		<pubDate>Thu, 08 Jul 2010 10:05:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.vancelucas.com/?p=562#comment-766</guid>
		<description>@Vance Lucas

That applies only to MySQL, in Postgres and other real databases you would have to use CAST(id AS TEXT)</description>
		<content:encoded><![CDATA[<p>@Vance Lucas</p>
<p>That applies only to MySQL, in Postgres and other real databases you would have to use CAST(id AS TEXT)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anooj</title>
		<link>http://www.vancelucas.com/blog/mongodb-gotchas/comment-page-1/#comment-765</link>
		<dc:creator>anooj</dc:creator>
		<pubDate>Thu, 08 Jul 2010 06:37:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.vancelucas.com/?p=562#comment-765</guid>
		<description>One additional thing to consider is that you really need to be economical when naming the fields. MongoDb stores the field names along with the values with each document. Which can be substantial when you have a non-trivial amount of Documents.</description>
		<content:encoded><![CDATA[<p>One additional thing to consider is that you really need to be economical when naming the fields. MongoDb stores the field names along with the values with each document. Which can be substantial when you have a non-trivial amount of Documents.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EllisGL</title>
		<link>http://www.vancelucas.com/blog/mongodb-gotchas/comment-page-1/#comment-762</link>
		<dc:creator>EllisGL</dc:creator>
		<pubDate>Thu, 08 Jul 2010 02:37:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.vancelucas.com/?p=562#comment-762</guid>
		<description>Another point, since it&#039;s schema-less, you must be careful about typo&#039;s.</description>
		<content:encoded><![CDATA[<p>Another point, since it&#8217;s schema-less, you must be careful about typo&#8217;s.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dude</title>
		<link>http://www.vancelucas.com/blog/mongodb-gotchas/comment-page-1/#comment-754</link>
		<dc:creator>dude</dc:creator>
		<pubDate>Wed, 07 Jul 2010 20:47:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.vancelucas.com/?p=562#comment-754</guid>
		<description>The two bits:

- you can use a string in place of an integer in a query, and
- case insensitive queries are the default

...in MySQL are complete mis-features. How can one claim that is sane? I would never be caught dead doing something silly like that. Who would actually expect &#039;jQuery&#039; and &#039;jquery&#039; to be the same thing in the database?!?</description>
		<content:encoded><![CDATA[<p>The two bits:</p>
<p>- you can use a string in place of an integer in a query, and<br />
- case insensitive queries are the default</p>
<p>&#8230;in MySQL are complete mis-features. How can one claim that is sane? I would never be caught dead doing something silly like that. Who would actually expect &#8216;jQuery&#8217; and &#8216;jquery&#8217; to be the same thing in the database?!?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vance Lucas</title>
		<link>http://www.vancelucas.com/blog/mongodb-gotchas/comment-page-1/#comment-753</link>
		<dc:creator>Vance Lucas</dc:creator>
		<pubDate>Wed, 07 Jul 2010 19:26:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.vancelucas.com/?p=562#comment-753</guid>
		<description>@Bryan

While it&#039;s true that you select a column type when defining a table schema in a relational database like MySQL, how the values are stored internally does not affect how you can query for that data. With relational SQL databases, all query parameters are effectively strings, even with prepared statements. There is no difference between these two queries in MySQL:

&lt;pre lang=&quot;mysql&quot; line=&quot;1&quot;&gt;SELECT * FROM posts WHERE id = 52;
SELECT * FROM posts WHERE id = &#039;52&#039;;&lt;/pre&gt;

They both return the exact same dataset in MySQL. That&#039;s the &quot;gotcha&quot; here. Data types in MongoDB affect how you can build your queries, whereas with relational SQL databases, they only matter if you want to use query functions like aggregates, date formatting, etc.</description>
		<content:encoded><![CDATA[<p>@Bryan</p>
<p>While it&#8217;s true that you select a column type when defining a table schema in a relational database like MySQL, how the values are stored internally does not affect how you can query for that data. With relational SQL databases, all query parameters are effectively strings, even with prepared statements. There is no difference between these two queries in MySQL:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> posts <span style="color: #990099; font-weight: bold;">WHERE</span> id <span style="color: #CC0099;">=</span> <span style="color: #008080;">52</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">SELECT</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">FROM</span> posts <span style="color: #990099; font-weight: bold;">WHERE</span> id <span style="color: #CC0099;">=</span> <span style="color: #008000;">'52'</span><span style="color: #000033;">;</span></pre></td></tr></table></div>

<p>They both return the exact same dataset in MySQL. That&#8217;s the &#8220;gotcha&#8221; here. Data types in MongoDB affect how you can build your queries, whereas with relational SQL databases, they only matter if you want to use query functions like aggregates, date formatting, etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Gourley</title>
		<link>http://www.vancelucas.com/blog/mongodb-gotchas/comment-page-1/#comment-752</link>
		<dc:creator>Tim Gourley</dc:creator>
		<pubDate>Wed, 07 Jul 2010 18:36:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.vancelucas.com/?p=562#comment-752</guid>
		<description>Those are definitely things to be careful with, Vance. Thanks for the writeup. And thanks Mike for adding your $0.02, you guys at 10gen rock!  Another thing to consider that I run into quite a bit is the fact that because of the heavy lifting done behinds the scene you really don&#039;t want to be sharing a mongod instance with something else heavy like MySQL. 

Often times I&#039;ve seen people install it alongside MySQL or have both a master and slave mongod instance running on the same machine/VM/slice/EC2 instance. You&#039;re going to run into resource bottlenecks eventually with that kind of setup.</description>
		<content:encoded><![CDATA[<p>Those are definitely things to be careful with, Vance. Thanks for the writeup. And thanks Mike for adding your $0.02, you guys at 10gen rock!  Another thing to consider that I run into quite a bit is the fact that because of the heavy lifting done behinds the scene you really don&#8217;t want to be sharing a mongod instance with something else heavy like MySQL. </p>
<p>Often times I&#8217;ve seen people install it alongside MySQL or have both a master and slave mongod instance running on the same machine/VM/slice/EC2 instance. You&#8217;re going to run into resource bottlenecks eventually with that kind of setup.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan Migliorisi</title>
		<link>http://www.vancelucas.com/blog/mongodb-gotchas/comment-page-1/#comment-751</link>
		<dc:creator>Bryan Migliorisi</dc:creator>
		<pubDate>Wed, 07 Jul 2010 18:22:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.vancelucas.com/?p=562#comment-751</guid>
		<description>Nice writeup, but I dont believe that &quot;Data is type-sensitive&quot; is a real &quot;gotcha&quot;.  

This fact is true of any relational database as well, where you have a &quot;defined schema&quot; as opposed to no schema in MongoDB.  The only difference is that you&#039;ll most likely run into insertion exceptions if your data doesnt match the type defined in the schema.

The shift here is that for things like MongoDB, your schema is effectively defined in your code rather than in your database.

Your application should know how to store and retrieve data from the database consistently, and if done correctly, will never run into the problem you have described of having keys with different value types.</description>
		<content:encoded><![CDATA[<p>Nice writeup, but I dont believe that &#8220;Data is type-sensitive&#8221; is a real &#8220;gotcha&#8221;.  </p>
<p>This fact is true of any relational database as well, where you have a &#8220;defined schema&#8221; as opposed to no schema in MongoDB.  The only difference is that you&#8217;ll most likely run into insertion exceptions if your data doesnt match the type defined in the schema.</p>
<p>The shift here is that for things like MongoDB, your schema is effectively defined in your code rather than in your database.</p>
<p>Your application should know how to store and retrieve data from the database consistently, and if done correctly, will never run into the problem you have described of having keys with different value types.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

