MongoDB doesn’t support unique indexes on embedded documents in the same document. However, it does support some scenarios for adding unique indexes on embedded documents. When you apply a unique index to an embedded document, MongoDB treats it as unique in the collection. The following is an example of setting up a unique index on an embedded document:
When doing web development, you need to test your work on many operating systems and browsers. Depending on your host operating system, you will also need to run virtual machines to test other operating systems and browsers. For this article, we are focusing on setting up different browsers/version on OS X (10.6 - Snow Leopard).
For Mac, the most common browsers are Safari, Firefox, Opera and recently Chrome. On my machine, I have setup the following browsers and versions:
- Safari: 2.04, 3.04, 3.12, 3.21, 4.04
- Firefox: 22.214.171.124, 3.0.17, 3.5.7
- Opera: 9.52, 9.64, 10.01, 10.10
- Chrome: 126.96.36.199 (Latest)
To keep things rolling, I’ve released another project called Reserved Word Search. With Reserved Word Search you can instantly find reserved words as you type. This is extremely useful when doing database design and/or designing an API.
So go ahead and check out Reserved Word Search @ www.reservedwordsearch.com.
I’ve been searching for an efficient way to set created and modified date fields in MySQL. Of course, this can be done in the application you’re writing, however, I wanted to find a way to automatically do this on the database layer.
Please note, this approach is targeted for MySQL 5.0+.
The approach I take here is a combination of using the TIMESTAMP field data type and a