maksHayovets
@maksHayovets
Нічого цікавого

How to combine(union all) two collections in one collection?

for example I have collection one with this data:

"_id": "60d75ed08af96529bf605030"
"Fname": "some name"
"Lname": "some last name"
"Age": "20"
"sex": "Woman"
"Previous_job": "Arsen"
"worksInShifts": "undefined"
"ShopAddress": "Shevchenka 43"
"NumberOFCashRegister": "8"
"__v":  "0"


and collection two with this data:

"_id": "60d75ed08af96529bf605030"
"Fname": "some name"
"Lname": "some last name"
"Age": "20"
"sex": "Woman"
"Previous_job": "Arsen"
"worksInShifts": "undefined"
"ShopAddress": "Shevchenka 43"
"NumberOFCashRegister": "8"
"__v":  "0"


(yes, these collections is the same)
I know how I can make it in MySQL using UNION ALL but I don't know how to make it in mongo db,
how can I combine these collections in one collection?
can give answer in Russian or Ukraine
  • Вопрос задан
  • 78 просмотров
Пригласить эксперта
Ответы на вопрос 1
@vbg8tmtm
Начиная с версии 4.4 там появилась операция unionWith https://docs.mongodb.com/manual/reference/operator...
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы