这些坐标的顺序不对,我需要为所有集合反转它们:
{ _id: ObjectId("638f9866d9014fabfc47275e"), address: '801 Pine St, Anchorage, AK', name: 'Russian Jack Skatepark', location: { type: 'Point', coordinates: [ 61.214855, -149.793563 ] } }
g2ieeal71#
You can use $reverseArray as follow:
db.collection.updateMany({}, [ { $set: { "location.coordinates": { $reverseArray: "$location.coordinates" } } } ])
Playgrouund
1条答案
按热度按时间g2ieeal71#
You can use $reverseArray as follow:
Playgrouund