If the Id
is supposed to represent the category, then you should call it CategoryId
. By calling the property Id
, you are picking up on Raven's convention that it should be treated as the primary key for that document. You can't save multiple versions of the same document. It will just overwrite the last version.
Assuming you've built your index correctly, you would just query it like so:
using Raven.Client.Linq;
...
var categoryIds = new[] {1, 3}; // whatever
var results = session.Query<Entity, YourIndex>()
.Where(x=> x.CategoryId.In(categoryIds));
(The .In
extension method is in the Raven.Client.Linq
namespace.)