So far, I've tried the following:
public class Widget
{
public int Id;
public string Name;
}
public static class Main
{
public static void Main()
{
// Initialize store and preload with widgets...
using (var session = store.OpenSession())
{
var widgets = session.Load<Widget>();
foreach(var widget in widgets)
{
Console.WriteLine(widget.Name);
}
}
}
}
I have been able to load all by adding an index and then using that index as a query:
var store = new DocumentStore();
store.DatabaseCommands.PutIndex("AllWidgets", new IndexDefinition<Widget>
{
Map = widget => from widget in widgets
select new { widget }
});
// Back in Main
var widgets = session.Query<Widget>("AllWidgets");
// Do stuff with widgets.
Is there a way to just get all documents of type Widget
without having to create an index?
At this point I'm just playing with RavenDB in a sandbox environment. I realize that this is usually not the best approach to fetching data.