adewes / blitzdb

Blitz is a document-oriented database for Python that is backend-agnostic. It comes with a flat-file database for JSON documents and provides MongoDB-like querying capabilities.
http://blitzdb.readthedocs.org
MIT License
330 stars 37 forks source link

Add basic unique indices #45

Closed cmutel closed 9 years ago

cmutel commented 9 years ago

Has some limitations:

This could be the starting point for a discussion on what this should look like, or could just be committed, if you think it is OK.

Sorry for whitespace diffs.

adewes commented 9 years ago

This looks great, @cmutel , thanks for adding it! Sorry that it took me so long to merge this, I was really busy in the last months unfortunately. All the tests pass and the functionality is already useful for the file backend, well done!

It should be straightforward to implement the unique property for the MongoDB backend, they seem to have an option for that:

http://docs.mongodb.org/manual/tutorial/create-a-unique-index/

Let me know if I can be of any help with this, I'll do my best to be more responsive!

cmutel commented 9 years ago

I don't have the time or desire to add this functionality to the Mongo backend, sorry.

Thanks again for the library, it is pretty great.