def find(klass, *args, **kwargs): """ Find a list of objects in the database, takes standard PyMongo-style input parameters (blocking):: users = User.find({}) #gets all users in the database print users """ from Mojo.ServerHelpers.RunServer import BACKEND_COLLECTION, DATABASE klass.collection_name = klass.__name__ if DATABASE: if BACKEND_COLLECTION: this_collection = BACKEND_COLLECTION(DATABASE, klass) ret_obj = this_collection.find(*args, **kwargs) return ret_obj