Sunday 15 May 2011

mongodb - Some field's type changes after exporting and importing with mongoimport -


Hello and thank you for thanking in advance. I was unable to find this question or solution in a different post, please tell me if I remember this.

My problem is that after the export and import, I'm looking at the $ value value of some fields, in the second collection I have data in the collection in Environment A., which I want to export and import I am a different environment. While looking at the source data in the environment, all types of fields correctly have a 64-bit integer ($ type 18 - from there). However, once the data is imported into the environment, 720 docks have a type of $ 16 (32-bit integer) in 5.

Output from environment A:

  mongos> Db.myCollection.count () 720 Monoies & gt; Db.myCollection.count ({createTime: {$ type: 16}}) 0 Mindos & gt; Db.myCollection.count ({createTime: {$ type: 18}})   

Data was exported from Environment A with the equivalent command: mongoexport --host my .environment .a.host.com -d myDb -c myCollection -o outputFile.json

Data was imported to Environment B with a similar order: mongoimport - Host my.environment B.host.com -d myDb -c myCollection --file outputFile.json

Looking at the data in Environment B, I see the following count / type:

db.plaAdGroupDoc.count ()


db.productDoc.count ({createTime: {$ Type: 16}})

db.productDoc.count ({CreateTime: {$ type: 18}}) 715 db.productDoc.count ()
720

I am not clear about why the types of fields are replaced by imports, except for the field only one Why is the small part changed?

Edit: Solution (Unable to answer the question within 8 hours), pay more attention to it, it seems that 5 Entires that were imported were a 32- Bit integer ($ type 16) had the value of 0 rather than large values, it seems that they are 64-bit inti If you have lost your inset instead of the question then the question has been solved

Hope it helps someone else!

You should not use MongoEstport and import if you are taking data between two mangodiabi examples The purpose of those devices is to exchange data with external systems.

Instead of using the Mongodump and MongroStore - they use the bson which is the original form of MongoDB and they do all types of protection.

No comments:

Post a Comment