0

i have a mongodb that it has many column Contains Id , name and phone number.I used a command to get the length of the phone numbers.I want to add the output obtained from the length of the phone numbers in a column to my database.I used the following command for this

db.rs1.aggregate( [ { $project: { "_id": 1,"phone number": 1, "length": { $strLenCP: "$phone number" }; ])

But the output (length) just appears, but not saved.How can I add this output(length) as a new column to my database

rshahrami
  • 63
  • 1
  • 8
  • Possible duplicate of [Aggregation with update in mongoDB](https://stackoverflow.com/questions/19384871/aggregation-with-update-in-mongodb) – Mazki516 Feb 09 '19 at 22:20

1 Answers1

0

It's a duplicate question weather you intended or not :)

The aggregation pipeline and the update is done in two different steps.

better look here Aggregation with update in mongoDB

Mazki516
  • 997
  • 1
  • 10
  • 20