Writing my own NoSql DB?

Yesterday I got a thought:

why not write something very simple that can store object-graphs without mappings and other fuss.

Yes I know there’s MongoDb, RavenDb and several others, but it’s always a great deal of fun to write something of your own. So, inspired by Ayende’s technology choices, I spent a few hours last night just fiddling around with Lucene.Net and Json.Net. The result:

A simple model

public class Address
    public string Street { get; set; }
    public string Zip { get; set; }
    public string City { get; set; }
    public string Country { get; set; }

public class Customer
    public Guid? Id { get; set; }

    public string Firstname { get; set; }

    public string Lastname { get; set; }
    public int ShoppingIndex { get; set; }

    public Address BillingAddress { get; private set; }
    public Address DeliveryAddress { get; private set; }

    public Customer()
        BillingAddress = new Address();
        DeliveryAddress = new Address();

Consuming a Storage-provider

var customer = new Customer
                        Id = Guid.NewGuid(),
                        Firstname = "Daniel",
                        Lastname = "Wertheim",
                        ShoppingIndex = 99
customer.DeliveryAddress.Country = "Sweden";

var store = new LuceneStructureStore();

var refetched = store.GetByKey<Customer>(customer.Id.ToString());

Maybe it will grow to something useful. In the meantime I will continue my work with my MongoDB-provider, Simple-MongoDB.


3 thoughts on “Writing my own NoSql DB?

  1. Hi Dennie,
    hope u dnt mind if i address u as dennie.
    hey as u told u designed ur own drivers for MongoDB which r simpler, n its an open source.
    so if u dnt mind may i have that source code for reference

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s