Seems like mongodb export does not select all columns from a document but only picks up fields from samples
SalmanShariaty mention a way to use an aggreagation pipeline to get all the fields in all documents. I nuance it futher for novices to know how to execute the pipeline
db.collectionName.aggregate([{$project: { arrayofkeyvalue: { $objectToArray: '$$ROOT'} }}, {$unwind: '$arrayofkeyvalue'}, {$group: { _id: null, allkeys: { $addToSet: '$arrayofkeyvalue.k' } }}])
No comments:
Post a Comment