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

depending on the output format, mongoexport displays different behaviors for --fields and --fieldFile options

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: mongoexport
    • Labels:

      1) --fieldFile option is ignored if using the default JSON output format or if using the --jsonArray option.

      Shouldn't it work like the --fields option which works with either JSON or CSV format?

      noticed in the export.cpp, there's this line which doesn't take the fieldFile parameter into consideration

      if ( hasParam( "fields" ) || csv ) {

      2) with the csv, we return only the fields listed in --fields or --fieldFile since we get specific fields from the object

      but, with JSON, we return the ``_id`` field along with the fields listed in --fields option (and if you specify a field in a subdocument a.b, will return the whole subdocument field a instead of just the a.b) since we do a straight

      out << obj.jsonString();

            Assignee:
            Unassigned Unassigned
            Reporter:
            kay.kim@mongodb.com Kay Kim (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: