Hello, and thank-you in advance.
1) I'm able to import a CSV file by using the following:
mongoimport d test01 -c items --type csv --headerline item-file v1.csv
- this file has 20 fields listed on the csv header, two of which are
Item Number and Price. - the database 'test01' has a collection 'items' with an Index for
Item Number as the key field (no duplicates). - requirement is to update prices wholesale by importing a concise
file of only two fields Item Number and Price and leaving the
remaining 18 fields as is.
I then try the following:
mongoimport -d test01 -c items --type csv --upsertFields "Item Number" --headerline item-file-update-v1.csv
- with the index on Item Number I get the following:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
connected to: 127.0.0.1
430220/443150 97%
23600 7866/second
imported 24323 objects-> no prices have been updated in the collection
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- with no index on the Item Number, I get the following:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
connected to: 127.0.0.1
imported 24323 objects-> the items from the csv were inserted as new items duplicating the
collection which is expected.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- I also tried this:
mongoimport -d test01 -c items -f "Item Number",Price --type csv --upsertFields "Item Number",Price --headerline item-file-update-v1.csv
-> same results of prices not being updated.
I'm not able to update the prices in the collection by using the
second update csv file. I searched for other upsertFields examples
but to no avail. Help on this would be very much appreciated.
also,
2) would there be an RoR gem that leverages mongoimport for csv file uploads?