S
S
spardarus2019-03-08 08:09:24
MongoDB
spardarus, 2019-03-08 08:09:24

MongoDB how to create and update a field?

I have records like this: {
" _id
" : "5c81d90a30ed9f23a8a12198", " decrypted "
: "Individual entrepreneur Vasiliev AN79456138423"
} IP Vasiliev AN79456138423", "inn" : 79456138423 } That is, for each record, take the value from the tag 79456138423 and add a new field "inn" to the record: 79456138423. I wrote only such a query that adds to each record the field "inn" with the value 1 db.trace.update({}, {$set:{"inn": 1}}, false, true)
Further, instead of the value "1" I can not think of an expression so that it selects a value from the tag 79456138423 for each record.
Please help, I've looked all over the internet and couldn't find a solution.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question