arqui78 / rock-php

Automatically exported from code.google.com/p/rock-php
0 stars 0 forks source link

binary data gets lost #156

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When editing an object with binary data, this data is replaced with
"key": "<Mongo Binary Data>"
and when object is saved, binary data is replaced with string "<Mongo Binary 
Data>"

it would be good to be able to edit other fields in object, without loosing 
contents of this binary field.

maybe, use MongoBinData(base64 data) or do not update fields with binary data 
when saving?

Original issue reported on code.google.com by Glebu...@gmail.com on 3 Aug 2011 at 9:51

GoogleCodeExporter commented 8 years ago

Original comment by anton.ze...@gmail.com on 8 Aug 2011 at 3:33

GoogleCodeExporter commented 8 years ago
Exporting of fs.chunks also doesn't work because of this. It's very unhandy 
when you cannot make a dump of whole database (including fs.chunks), because of 
this bug.

I resolved this with just 3 lines code in /app/classes/VarExportor.php in the 
function _formatVarAsJSON() in the switch block. Just added this:

case "MongoBinData":
  $this->_jsonParams[$this->_paramIndex] = 'new BinData(0, "'.base64_encode($var-> bin).'")';
  return $this->_param($this->_paramIndex);

Now I'm happy:) Please add something of this to fully support exporting of the 
db and to avoid bug after editing documents with binary data.

Original comment by e.rota...@gmail.com on 8 Dec 2011 at 12:49

GoogleCodeExporter commented 8 years ago
Please fix that. It's very annoying, especially when used in Jelastic, where 
RockMongo sources cannot be changed.

Original comment by virlof@gmail.com on 16 Oct 2014 at 10:36