0

I have a bash script for generating daily csv reports from a collection. In the script I'm using mongoexport such as:

mongoexport --authenticationDatabase $DBNAME -h $CONN_STRING -u $USERNAME -p $PASSWORD --db listings --collection listings --type=csv --out $EXTRACTED_FILE_NAME --fields _id,Version,MerchantId,HBSku,MerchantSku,Price.Currency,Price.Amount,AvailableStock,CommissionRate,CommissionType,PaymentTermInDays,CreatedAt,UpdatedAt,IsActive,DispatchTime,IsSalable,CargoCompanies.0 --query "{ \$or: [{\"CreatedAt\" : { \$gte : { \"\$date\" : \"$OLD_DATE$DATE_POSIX\" }}}, {\"UpdatedAt\" : { \$gte : { \"\$date\" : \"$OLD_DATE$DATE_POSIX\" }}}]}"

Or problem related part:

--fields _id,Version,MerchantId,HBSku,MerchantSku,Price.Currency,Price.Amount,AvailableStock,CommissionRate,CommissionType,PaymentTermInDays,CreatedAt,UpdatedAt,IsActive,DispatchTime,IsSalable,CargoCompanies.0

The last parameter, CargoCompanies is an integer array and represented as:

"CargoCompanies" : [
    NumberInt(1)
]

MongoExport generates file and puts empty string to CargoCompanies.0 field.

What I want is that mongoexport should put first element value of CargoCompanies: 1. Not NumberInt(1), just 1.

What should I do?

Thanks.

1 Answer 1

0

In mongoexport's new version r3.0.14, the bug is fixed, When you try to export an array field of integers,

[1,2,3] is printed in a csv file instead of

[
    NumberInt(1), NumberInt(2), NumberInt(3)
]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.