On Tue, Nov 09, 2010 at 12:07:19PM -0800, Patrick Gannon wrote: > > I am creating a storage provider for MongoDB and am reverse-engineering the > expected behavior of the storage interface methods from the Hash storage and > Couch storage providers. Unless I am missing something, it looks like there > is an inconsistency between how those two providers will behave if get_many > is called with :count = true in the options. It seems that in the hash > storage, it will return the count of documents matching the key parameter > (see > https://github.com/jmettraux/ruote/blob/ruote2.1/lib/ruote/storage/hash_storage.rb > line > 136), whereas in the Couch storage, it will return the count of all > documents, regardless of they key parameter (see > https://github.com/jmettraux/ruote-couch/blob/ruote2.1/lib/ruote/couch/database.rb > line > 87). Which is the correct behavior, or is it undetermined (doesn't matter)?
Hello Pat, just a little trick with the GitHub web interface, you can click on code lines and it changes the current page fragment, resulting in : https://github.com/jmettraux/ruote/blob/ruote2.1/lib/ruote/storage/hash_storage.rb#L135 https://github.com/jmettraux/ruote-couch/blob/ruote2.1/lib/ruote/couch/database.rb#L87 With click and a shift-click you can even highlight zones : https://github.com/jmettraux/ruote-couch/blob/ruote2.1/lib/ruote/couch/database.rb#L85-98 Sorry for the digression. Well spotted. There is a trick with the CouchDB implementation, instead of putting all the types in the same Couch database, it puts them each in their own. https://github.com/jmettraux/ruote-couch/blob/ruote2.1/lib/ruote/couch/storage.rb#L98-101 It saves a bit of time, when getting all the docs of a certain type. It saves the time necessary to maintain an index on the type if all the documents were in the same database. This test https://github.com/jmettraux/ruote/blob/ruote2.1/test/unit/storage.rb ensures that all the storages behave in the same way. BTW, please tell me if you need me to update that document : http://ruote.rubyforge.org/implementing_a_storage.html Best regards, -- John Mettraux - http://jmettraux.wordpress.com -- you received this message because you are subscribed to the "ruote users" group. to post : send email to [email protected] to unsubscribe : send email to [email protected] more options : http://groups.google.com/group/openwferu-users?hl=en
