1 Answer
- Newest
- Most votes
- Most comments
0
Hello. You could use the Javascript parseFloat() method and programmatically update those strings to double in the existing collection. Or use an $out stage in the aggregation and update the results afterwards. Something like this will loop through all documents in the collection and update the string:
db.collection.find({}).forEach( function(doc) {
doc.subDoc.stringVar = parseFloat( doc.subDoc.stringVar );
db.collection.update( { _id: doc._id }, {$set: { "subDoc.stringVar": doc.subDoc.stringVar } } )
});
answered 2 years ago
Relevant content
- asked 6 months ago
- asked a year ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 8 months ago
- How do I resolve issues with an Amazon DocumentDB instance that is in an incompatible-network state?AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated 8 months ago