int32 solution becomes double when the update data mongodb & Tutorial mongodb update data becomes int32 solution of double

https://www.runoob.com/mongodb/mongodb-mongodump-mongorestore.html

 

 

int32 solution becomes double when the update data mongodb

 

   Scenes:

    In order integer fields synState manually modify the sign-in sheet, Multi plurality of parameters can be updated, if an update is false.

db.getCollection ( "ClassRecordOneDetail") update ( {synStateTime:. { "$ gt": new Date ( "2019-05-12")}, synStateTime: { "$ lt": new Date ( "2019-05-13 ")}}, {$ set : {synState: 0}}, {multi: true}); 

after updating the inquiry found synState becomes the double type to 0.0 


Solution:

   The Internet looking for a bit and found to add type conversion job

   db.getCollection("ClassRecordOneDetail").update({synStateTime:{"$gt":new Date("2019-05-12")},synStateTime:{"$lt":new Date("2019-05-13")}},{$set:{synState:NumberInt(0)}},{multi:true});

 

db.t_element_access_reason.find( { "sessionId" : NumberLong("6421359123204194756") } )

 

 

   Scenes:

    In order integer fields synState manually modify the sign-in sheet, Multi plurality of parameters can be updated, if an update is false.

db.getCollection ( "ClassRecordOneDetail") update ( {synStateTime:. { "$ gt": new Date ( "2019-05-12")}, synStateTime: { "$ lt": new Date ( "2019-05-13 ")}}, {$ set : {synState: 0}}, {multi: true}); 

after updating the inquiry found synState becomes the double type to 0.0 


Solution:

   The Internet looking for a bit and found to add type conversion job

   db.getCollection("ClassRecordOneDetail").update({synStateTime:{"$gt":new Date("2019-05-12")},synStateTime:{"$lt":new Date("2019-05-13")}},{$set:{synState:NumberInt(0)}},{multi:true});

 

db.t_element_access_reason.find( { "sessionId" : NumberLong("6421359123204194756") } )

 

 

Guess you like

Origin www.cnblogs.com/kelelipeng/p/12010595.html