Transform the MongoDB value into a Marrow Mongo value.
195800
def to_native(self, obj, name, value):
		""""""
		
		if isinstance(value, self.List):
			return value
		
		result = self.List(super(Array, self).to_native(obj, name, i) for i in value)
		obj.__data__[self.__name__] = result
		
		return result
717567
protected function convertValue()
    {
        $values = $this->getValue();
        $convertedValues = array();

        if (($values instanceof Collection) || is_array($values)) {
            foreach ($values as $value) {
                if (!is_object($value) || !method_exists($value, 'getId')) {
                    continue;
                }

                $convertedValues[] = $value->getId();
            }
        } elseif (is_object($values) && method_exists($values, 'getId')) {
            $convertedValues[] = $values->getId();
        }

        return $convertedValues;
    }
182335
def to_native(self, value):
        """"""
        if isinstance(value, six.string_types):
            value_list = value.split(self.string_delim)
        else:
            value_list = value

        to_native = self.member_type.to_native if self.member_type is not None else lambda x: x
        return [to_native(item) for item in value_list]
508292
def to_foreign(self, obj, name, value):  # pylint:disable=unused-argument
		""""""
		
		from marrow.mongo import Document
		
		kind = self._kind(obj if isclass(obj) else obj.__class__)
		
		if isinstance(value, Document):
			if __debug__ and kind and issubclass(kind, Document) and not isinstance(value, kind):
				raise ValueError("Not an instance of " + kind.__name__ + " or a sub-class: " + repr(value))
			
			return value
		
		if isinstance(kind, Field):
			kind.validator.validate(value, FieldContext(kind, obj))
			return kind.transformer.foreign(value, FieldContext(kind, obj))
		
		if kind:
			value = kind(**value)
		
		return value
1212567
function stringToBinaryUUID(value) {
    // for compatiblity reason check if value is already converted...
    if (typeof value !== "string") {
        return value;
    }
    const hex = value.replace(/[{}-]/g, ""); // remove extra characters
    const buffer = new Buffer(hex, "hex");
    return new mongodb_1.Binary(buffer, mongodb_1.Binary.SUBTYPE_UUID);
}
1149234
def append(self, value):
        """"""
        return super(Collection, self).append(
            self._ensure_value_is_valid(value))
1334598
def _deserialize(self, value, environment=None):
        """"""

        if not isinstance(value, CollectionABC):
            raise exc.Invalid(self)

        items_class = self.items.__class__
        invalids = []

        # traverse items and match against validated struct
        collection = self.collection_type()

        for i, subvalue in enumerate(value):
            item = items_class(name=i)
            try:
                self.collection_pusher(collection, item.deserialize(subvalue, environment=environment))

            except exc.Invalid as ex:
                invalids.append(ex)

        if invalids:
            # on invalids this item is also ``Invalid``
            raise exc.InvalidChildren(self, invalids)

        return collection
522671
def convert_mapping(self, mapping):
        """"""
        if isinstance(mapping, dict):
            return self.convert_items(iteritems(mapping))
        return self.convert_items(mapping)
531281
function(value, space) {
    /*
      ObjectIds are serialized as @@id
      DBRefs are serialized as @@collection@id or @@collection@@id, depending on whether id is an objectid
      string values starting @ @ are prepended with ::
    */
    return JSON.stringify(value, function(k,v) {
      if (v && typeof v === 'object') {
        //we have to do it like this to avoid toString being call internally
        var copy = new v.constructor();
        for (var prop in v) {
          if (!v.hasOwnProperty(prop)) continue;
          var val = v[prop]
          if (val instanceof ObjectID) {
              val = "@@" + val;
          } else if (val instanceof DBRef) {
            if (val.oid instanceof ObjectID)
              val = '@@' + val.namespace + '@@' + val.oid;
            else
              val = '@@' + val.namespace + '@' + val.oid;
          } else {
            if (typeof val == 'string' && (val.slice(0,2) == '@@')) {
             val = '::' + val;
            }
          }
          copy[prop] = val;
        }
        return copy;
      }
      return v;
    }, space);
  }
1240707
def prepare_data(self, data=None):
        '''
        
        '''
        data = data or self.export_data(native=True)
        # make sure we don't persist a null _id and let MongoDB auto-generate it
        if '_id' in data and data['_id'] is None:
            del data['_id']
        return data
1133958
public function extract($value)
    {
        if ($this->nullable && $value === null) {
            return null;
        }
        
        return new MongoBinData($value, $this->type);
    }
669165
def _convert_value(self, column, value):
        ''''''

        if isinstance(value, GObject.Value):
            return value
        return GObject.Value(self.get_column_type(column), value)
918043
def transform_incoming(self, son, collection):
        
        for (key, value) in son.items():
            if isinstance(value, dict):  # Make sure we recurse into sub-docs
                son[key] = self.transform_incoming(value, collection)
            elif hasattr(value, 'serialize'):
                LOG.debug("Serializing object: %s", value)
                son[key] = value = value.serialize()
        return son
698440
private function transformIfId($value)
    {
        if ($value && $this->isObjectId($value)) {
            $value = new ObjectId($value);
        }

        return $value;
    }
1137214
def transform_incoming(self, son, collection):
        

        def transform_value(value):
            if isinstance(value, collections.MutableMapping):
                if "_id" in value and "_ns" in value:
                    return DBRef(value["_ns"], transform_value(value["_id"]))
                else:
                    return transform_dict(SON(value))
            elif isinstance(value, list):
                return [transform_value(v) for v in value]
            return value

        def transform_dict(object):
            for (key, value) in object.items():
                object[key] = transform_value(value)
            return object

        return transform_dict(SON(son))
367275
def inc_convert(self, value):
        """"""
        if not os.path.isabs(value):
            value = os.path.join(self.base, value)
        with codecs.open(value, 'r', encoding='utf-8') as f:
            result = json.load(f)
        return result
290757
public JacksonDBCollection<T, K> rename(String newName) throws MongoException {
        return rename(newName, false);
    }