Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-28

mongodump/mongoexport specify projection

    • Type: Icon: New Feature New Feature
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: mongodump
    • 3
    • 1,885

      mongodump can use the -q option to limit the documents dumped to a query pattern. However, the results can't be "shaped" with a projection the way a normal query can be. In the absence of SERVER-14880 or SERVER-14881, the only usable option is to iterate the query cursor client-side, and then either

      1. insert the documents into some other database, dump it, and then drop it, or
      2. just printjson the results from inside --eval and redirect stdout to a file.

      This could apply to mongoexport --fields as well.

      Update: consider the possibility of negative projection (aka blacklist) as well, as mentioned in TOOLS-2313. Perhaps we should take a full projection document as Extended JSON?

            Assignee:
            Unassigned Unassigned
            Reporter:
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            7 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated: