riteshrao/ravenjs — pull request #2 by xzachtli (2012-10-24 17:34:07+00:00)
Title: Adhere to Raven best practices for id's and collection names

* raven.create now expects typeName (Raven-Clr-Type) as first arg and
generates collectionName (Raven-Entity-Name) as pluralized typeName
unless overridden with second arg

Best practice reference: "collection name (which by default is the entity name in its plural form)" from http://ravendb.net/docs/client-api/basic-operations/saving-new-document

Default
raven.create('foo') -> Raven-Clr-Type='foo', Raven-Entity-Name='foos'

Override collection
raven.create('foo', foobars) -> Raven-Clr-Type='foo', Raven-Entity-Name='foobars'

Singular
raven.create('foo', false) -> Raven-Clr-Type='foo', Raven-Entity-Name='foo'

* defaultIdGenerator expects a doc to be passed in to generate ids in
the form of "collectionName/123" rather than just "123"

Best practice reference: "RavenDB will assign it with a document ID that is combined of the collection name and the next available ID from the given range." from http://ravendb.net/docs/client-api/basic-operations/saving-new-document