mongoframes/frames.py
def unset_many(self, documents, *fields):
        """Unset the given list of fields for this document."""

        # Ensure all documents have been converted to frames
        frames = cls._ensure_frames(documents)

        all_count = len(documents)
        assert len([f for f in frames if '_id' in f._document]) == all_count, \
                "Can't update documents without `_id`s"

        # Send update signal
        signal('update').send(cls, frames=frames)

        # Build the unset object
        unset = {}
        for field in fields:
            unset[field] = True

        # Clear the fields from the documents and build a list of ids to
        # update.
        ids = []
        for document in documents:
            ids.append(document._id)
            for frame in frames:
                frame._document.pop(field, None)

        # Update the document
        self.get_collection().update_many(
            {'_id': {'$in': ids}},
            {'$unset': unset}
        )

        # Send updated signal
        signal('updated').send(cls, frames=frames)
Unset the given list of fields for this document.
Unset the given list of fields for this document.
Unset the given list of fields for this document .
def unset_many(self, documents, *fields):
        frames = cls._ensure_frames(documents)
        all_count = len(documents)
        assert len([f for f in frames if '_id' in f._document]) == all_count, \
                "Can't update documents without `_id`s"
        signal('update').send(cls, frames=frames)
        unset = {}
        for field in fields:
            unset[field] = True
        ids = []
        for document in documents:
            ids.append(document._id)
            for frame in frames:
                frame._document.pop(field, None)
        self.get_collection().update_many(
            {'_id': {'$in': ids}},
            {'$unset': unset}
        )
        signal('updated').send(cls, frames=frames)
def unset_many ( self , documents , * fields ) : frames = cls . _ensure_frames ( documents ) all_count = len ( documents ) assert len ( [ f for f in frames if '_id' in f . _document ] ) == all_count , "Can't update documents without `_id`s" signal ( 'update' ) . send ( cls , frames = frames ) unset = { } for field in fields : unset [ field ] = True ids = [ ] for document in documents : ids . append ( document . _id ) for frame in frames : frame . _document . pop ( field , None ) self . get_collection ( ) . update_many ( { '_id' : { '$in' : ids } } , { '$unset' : unset } ) signal ( 'updated' ) . send ( cls , frames = frames )
Unset the given list of fields for this document.
Unset the given list of fields for this document .
"""Unset the given list of fields for this document.""" # Ensure all documents have been converted to frames # Send update signal # Build the unset object # Clear the fields from the documents and build a list of ids to # update. # Update the document # Send updated signal
self
documents