Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "Sigle_1": "BIOS",
- "Sigle_2": "BFTA"
- },
- {
- "Sigle_1": "BERP",
- "Sigle_2": "BEST"
- },
- {
- "Sigle_1": "BHDL",
- "Sigle_2": "BIOS"
- },
- {
- "Sigle_1": "BIPM",
- "Sigle_2": "BEST"
- },
- {
- "Sigle_1": "BHDL",
- "Sigle_2": "BIOS"
- }
- {
- "Sigle": "BIOS",
- },
- {
- "Sigle": "BFTA",
- },
- {
- "Sigle": "BERP",
- },
- {
- "Sigle": "BEST",
- },
- {
- "Sigle": "BHDL",
- },
- {
- "Sigle": "BIPM",
- }
- db.users.aggregate([{$group: {_id: {Sigle1: '$Sigle_1', Sigle2: '$Sigle_2'}}}])
- db.collection.aggregate([
- { "$facet": {
- "array1": [
- { "$group": {
- "_id": "$Sigle_1"
- }}
- ],
- "array2": [
- { "$group": {
- "_id": "$Sigle_2"
- }}
- ]
- }},
- { "$addFields": {
- "data": {
- "$concatArrays": ["$array1", "$array2"]
- }
- }},
- { "$unwind": "$data" },
- { "$replaceRoot": { "newRoot": "$data" }},
- { "$group": {
- "_id": "$_id"
- }},
- { "$project": { "Sigle": "$_id", "_id": 0 }}
- ])
- [
- {
- "Sigle": "BFTA"
- },
- {
- "Sigle": "BEST"
- },
- {
- "Sigle": "BHDL"
- },
- {
- "Sigle": "BERP"
- },
- {
- "Sigle": "BIPM"
- },
- {
- "Sigle": "BIOS"
- }
- ]
- {
- "Sigle_1": "BIOS",
- "Sigle_2": "BFTA",
- "Name_1": "Basic Input Output System",
- "Name_2": "Belgian Food Truck Association"
- },
- {
- "Sigle_1": "BERP",
- "Sigle_2": "BEST",
- "Name_1": "British Experimental Rotor Programme",
- "Name_2": "Board of European Students of Technology"
- },
- {
- "Sigle_1": "BHDL",
- "Sigle_2": "BIOS",
- "Name_1": "B Hardware Description Language",
- "Name_2": "Basic Input Output System"
- },
- {
- "Sigle_1": "BIPM",
- "Sigle_2": "BEST",
- "Name_1": "Brevet d'initiation au parachutisme militaire",
- "Name_2": "Board of European Students of Technology"
- },
- {
- "Sigle_1": "BHDL",
- "Sigle_2": "BIOS",
- "Name_1": "B Hardware Description Language",
- "Name_2": "Basic Input Output System"
- }
- db.collections.aggregate([
- { "$facet": {
- "array1": [
- { "$group": {
- "_id": "$Sigle_1"
- }}
- ],
- "array2": [
- { "$group": {
- "_id": "$Sigle_2"
- }}
- ],
- "array3": [
- { "$group": {
- "_id": "$Name_1"
- }}
- ],
- "array4": [
- { "$group": {
- "_id": "$Name_2"
- }}
- ]
- }},
- { "$addFields": {
- "data": {
- "$concatArrays": ["$array1", "$array2"]
- },
- "data_1": {"$concatArrays": ["$array3", "$array4"]
- }
- }}
- ])
Add Comment
Please, Sign In to add comment