Azure DocumentDB Limitation

The original document  is here at, but I am making note to myself here too.  These are worthy to know when you are working DocumentDB and designing the service structure.

  • You can only have up to 5 database accounts by default.
  • You can only have up to 100 database per account.
  • Number of users per account is 500,000.
  • Number of permission per database account is 2,000,000.
  • Attachment storage per database account is 2GB (I ll probably use blob storage and just have uri reference to the location so I m not so worry about this limitation now)
  •  Max request units per second per collection is 2500.
  • Number of stored procedures, triggers and UDFs per collection is 25 each.
  • Max execution time for stored procedure and trigger is 5 seconds.
  • Provisioned document storage / collection is 10GB.
  • Max collections per database account is 100. (so that’s 500 max in account)
  • Max document storage per database 1TB. = Number of collection is up to 100 and that has to be less than 1TB.
  • Max length of the ID property is 255 characters.
  • Max items per page is unlimited. There is no limit here but if I must say that’s 1TB worthy of documents to page.
  • Max request size of document and attachment is 512kb.
  • Max response size is 1MB. (how big or small is 1MB of JSON file?)
  • All request or when you talk to documentDB must be UTF-8 encode standard.
  • Max number of UDFs per query is 2.
  • Max number of JOINs per query is 5.
  • Max number of AND caluse per query is 20.
  • Max number of values per IN expression is 200.
  • Max number of points in a polygon argument in a ST_WITHIN query is 16 (don’t know what this is.. I will look into it later)
  • Max number of collection creates per minute is 5.
  • Max number of scale operations per minute is 5.

Migration, Code First Database (EF)

When you are developing your web service, and working with your data set, often you need to make modification to your data set, and definition of your data set.  We can simply initialize (aka, delete and start clean) or migrate to continue on with data you have.

There are two types of migration Automatic Migration and C0de-Based Migration.  I am a lazy guy and I typically choose Automatic Migration, but I do come across situation where I have to run Code-Base migration, so I ll cover both here.

First you have to enable migration. Go to package manager console and run,

Then you should see something like;

Now you should see Migration folder being created, and we check Configuration.cs within that folder.  Then we will edit value for AutomaticMigrationEnabled to true to enable Automatic Migration.

Then we just run command below to let them automatically update whatever and however they want.


Next, I will cover the manual migration process.

You can also refer to ;