I've been looking at increasing the amount of MongoDB we use at work, and this includes backing up the data. Due to my own confusion, I had a little issue getting
mongodump writes in a format called Binary JSON, or BSON. I installed BSON.pm with the intention of reading the BSON file and ensuring it works. with small tests, I was able to put objects into BSON, write to file, read from file, and use
But, I find I cannot read the file, because BSON.pm reports it as having an incorrect length.
mongodump
to work, but I have been able to dump from one Mongo database and restore to another.mongodump writes in a format called Binary JSON, or BSON. I installed BSON.pm with the intention of reading the BSON file and ensuring it works. with small tests, I was able to put objects into BSON, write to file, read from file, and use
Data::Dumper
to display the object is what I wanted it to be.But, I find I cannot read the file, because BSON.pm reports it as having an incorrect length.
I fully expect that I'm doing something subtly stupid, but what it could be isn't immediately obvious. the contents of
I suppose I don't need to read the BSON files, but I do like being able to check the contents of a database before restoring.
$bson
should be exactly as written to file, and mongorestore
was happy with it. encode()
and decode()
had worked acceptably, but admittedly on a much smaller dataset than the one I'm working with here, which contains several months of status updates.I suppose I don't need to read the BSON files, but I do like being able to check the contents of a database before restoring.
No comments:
Post a Comment