Question: There are a number of post in relation to Visual Studio building projects when not necessary. However, none seem to cover this particular issue.

I'm running Visual Studio 2012 Professional Update 4.

In my solution, I have a unit test project that has a project reference to a BizTalk Transforms project. This in-turn has a project reference to a BizTalk schemas project.

Every time I choose to run a unit test, the whole solution is built, even though no changes have been made.

The first line displayed in the build window is as follows:

> 
> Input file
>  'C:\Workspaces\rbowman\Branches\Current-branchRB\WareHouse\FFF.Enterprise.WareHouse.Schemas\FFF.Enterprise.WareHouse.Schemas.btproj.user'
>  is modified after output file
>  'C:\Workspaces\rbowman\Branches\Current-branchRB\WareHouse\FFF.Enterprise.WareHouse.Schemas\bin\Release\FFF.Enterprise.WareHouse.Schemas.pdb'.
> 
> 
> 

Note: it seems to be the **.user** file that's causing the rebuild.
Does anyone know how to prevent this? Strange but I only seem to be getting the problem with BizTalk proj files. I am seeing this behavior across multiple solutions but the problem file is always identified as a btproj.user.

This screencast illustrates the problem: [screencast link](http://biztalkers.com/video/build-before-test.mp4)

Answer: 
As JohnnyHK suggested in comments, and Oz123 pointed to in his answer, the issue here appears to be an index that has grown so large that it fails to perform well as an index. I believe that in addition to the category expansion issue that has already been pointed out, the ordering of fields in your index creates trouble. Compound indexes are [built according to the order of fields](https://docs.mongodb.org/manual/core/index-compound/), and putting `name` after `categoriesIds` makes it more costly to query on `name`. 

It's clear that you need to tune your indexes. Exactly how you tune them depends on the types of queries that you are expecting to support. In particularly, I'm not sure if you'll see better performance from a compound index of `loc` and `name` or if you'll see better performance from individual indexes, one for `loc` and one for `name`. Mongo themselves are [a little vague](https://docs.mongodb.org/manual/core/index-intersection/#index-intersection-compound-indexes) on when it's best to use a compound index and when it's best to use individual indexes and rely on index intersection. 

My intuition says that individual indexes will perform better, but I'd test both scenarios. 

If you anticipate needing to query by category as well, without `name` or `loc` fields that could narrow the query down, it's probably best to create a separate `categoriesIds` index.
Not sure if it is exactly the same issue but we had a similar problem with a **multikey index** with poor performance when no results were found.

It is actually a Mongo bug that was fixed in v3.3.8. 
<https://jira.mongodb.org/browse/SERVER-15086>

We fixed our problems after upgrading Mongo and rebuilding the index.