cos-archives / modular-odm

A database-agnostic Object-Document Mapper for Python.
Apache License 2.0
13 stars 18 forks source link

How to extend a Collection #86

Closed neurosnap closed 7 years ago

neurosnap commented 10 years ago

How would I go about adding functionality at the collection level using modular-odm?

For example, if I would like to map reduce a collection:

http://api.mongodb.org/python/2.0/api/pymongo/collection.html#pymongo.collection.Collection.map_reduce

jmcarp commented 10 years ago

Collection-level actions are generally class methods of StoredObject--see StoredObject::find, StoredObject::remove, etc.

neurosnap commented 10 years ago

Thanks! Are there any issues with putting a mongodb specific method in StoredObject? On Mar 30, 2014 9:02 PM, "Joshua Carp" notifications@github.com wrote:

Collection-level actions are generally class methods of StoredObject--see StoredObject::find, StoredObject::remove, etc.

Reply to this email directly or view it on GitHubhttps://github.com/CenterForOpenScience/modular-odm/issues/86#issuecomment-39046441 .

lyndsysimon commented 9 years ago

To my knowledge there is nothing on StoredObject that is specific to any backend - and as far as I know, that's by design at this point.

You might consider either subclassing it to something like MongoStoredObject, or we'll need to settle on an architecture through which collection-level methods can be exposed in a backend-independent way. Would you be interested in helping define what that might look like?