Switch to unified view

a/Ming/ming/session.py b/Ming/ming/session.py
...
...
39
        return self.find(cls, kwargs)
39
        return self.find(cls, kwargs)
40
40
41
    def count(self, cls):
41
    def count(self, cls):
42
        return self._impl(cls).count()
42
        return self._impl(cls).count()
43
43
44
    def ensure_index(self, cls, fields):
44
    def ensure_index(self, cls, fields, **kwargs):
45
        if not isinstance(fields, (list, tuple)):
45
        if not isinstance(fields, (list, tuple)):
46
            fields = [ fields ]
46
            fields = [ fields ]
47
        index_fields = [(f, pymongo.ASCENDING) for f in fields]
47
        index_fields = [(f, pymongo.ASCENDING) for f in fields]
48
        return self._impl(cls).ensure_index(index_fields)
48
        return self._impl(cls).ensure_index(index_fields, **kwargs)
49
49
50
    def ensure_indexes(self, cls):
50
    def ensure_indexes(self, cls):
51
        for idx in getattr(cls.__mongometa__, 'indexes', []):
51
        for idx in getattr(cls.__mongometa__, 'indexes', []):
52
            self.ensure_index(cls, idx)
52
            self.ensure_index(cls, idx)
53
        for idx in getattr(cls.__mongometa__, 'unique_indexes', []):
54
            self.ensure_index(cls, idx, unique=True)
53
55
54
    def group(self, cls, *args, **kwargs):
56
    def group(self, cls, *args, **kwargs):
55
        return self._impl(cls).group(*args, **kwargs)
57
        return self._impl(cls).group(*args, **kwargs)
56
58
57
    def update_partial(self, cls, spec, fields, upsert):
59
    def update_partial(self, cls, spec, fields, upsert):