patternMinor
Backup with mongoexport or mongodump?
Viewed 0 times
withmongodumpmongoexportbackup
Problem
For production backup, MongoDB recommends mongodump instead of mongoexport for accuracy of data. However, I would need to "scrub" data off a MongoDB database before backing it up. I am not aware of any server-side data scrubbing options other than mongoexport. Two questions:
- Does mongoexport access MongoDB cache in RAM? Would it alter the working set in RAM like mongodump does?
- mongodump command has this --query option. "Provides a JSON document as a query that optionally limits the documents included in the output of mongodump." Does it take a query to exclude certain fields in a document?
Solution
-
(sorry, dunno)
-
--query will select or exclude entire documents, not fields.
It would be a good idea though :
(sorry, dunno)
-
--query will select or exclude entire documents, not fields.
It would be a good idea though :
--query '{datetime:{$gt:ISODate("2014-01-01T00:00:00.000Z")}},{_id:0,name:1,address:1,interests:1}'* )- Mongodump uses bson file structure and preserves the data types. Mongoexport will lose data type of the values. Such as NumberLong("1431677405876") would be converted to just 1431677405876. That's why mongodump is advised if you need to import back to MongoDB.
Code Snippets
--query '{datetime:{$gt:ISODate("2014-01-01T00:00:00.000Z")}},{_id:0,name:1,address:1,interests:1}'* )Context
StackExchange Database Administrators Q#107549, answer score: 6
Revisions (0)
No revisions yet.