Skip to content

Commit ad829bb

Browse files
Merge pull request #245987 from Clare-Zheng82/0724-Upgrade_MongoDB_LS
[Doc update] Upgrade MongoDB linked service
2 parents cae49b0 + 6eab224 commit ad829bb

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

articles/data-factory/connector-mongodb.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.service: data-factory
88
ms.subservice: data-movement
99
ms.topic: conceptual
1010
ms.custom: synapse, ignite-2022
11-
ms.date: 10/25/2022
11+
ms.date: 07/24/2023
1212
---
1313

1414
# Copy data from or to MongoDB using Azure Data Factory or Synapse Analytics
@@ -251,6 +251,20 @@ To achieve such schema-agnostic copy, skip the "structure" (also called *schema*
251251

252252
To copy data from MongoDB to tabular sink or reversed, refer to [schema mapping](copy-activity-schema-and-type-mapping.md#schema-mapping).
253253

254+
## Upgrade the MongoDB linked service
255+
256+
Here are steps that help you upgrade your linked service and related queries:
257+
258+
1. Create a new MongoDB linked service and configure it by referring to [Linked service properties](#linked-service-properties).
259+
1. If you use SQL queries in your pipelines that refer to the old MongoDB linked service, replace them with the equivalent MongoDB queries. See the following table for the replacement examples:
260+
261+
| SQL query | Equivalent MongoDB query |
262+
|:--- |:--- |
263+
| `SELECT * FROM users` | `db.users.find({})` |
264+
| `SELECT username, age FROM users` |`db.users.find({}, {username: 1, age: 1})` |
265+
| `SELECT username AS User, age AS Age, statusNumber AS Status, CASE WHEN Status = 0 THEN "Pending" CASE WHEN Status = 1 THEN "Finished" ELSE "Unknown" END AS statusEnum LastUpdatedTime + interval '2' hour AS NewLastUpdatedTime FROM users` | `db.users.aggregate([{ $project: { _id: 0, User: "$username", Age: "$age", Status: "$statusNumber", statusEnum: { $switch: { branches: [ { case: { $eq: ["$Status", 0] }, then: "Pending" }, { case: { $eq: ["$Status", 1] }, then: "Finished" } ], default: "Unknown" } }, NewLastUpdatedTime: { $add: ["$LastUpdatedTime", 2 * 60 * 60 * 1000] } } }])`|
266+
| `SELECT employees.name, departments.name AS department_name FROM employees LEFT JOIN departments ON employees.department_id = departments.id;`|`db.employees.aggregate([ { $lookup: { from: "departments", localField: "department_id", foreignField: "_id", as: "department" } }, { $unwind: "$department" }, { $project: { _id: 0, name: 1, department_name: "$department.name" } } ])` |
267+
254268

255269
## Next steps
256270
For a list of data stores supported as sources and sinks by the copy activity, see [supported data stores](copy-activity-overview.md#supported-data-stores-and-formats).

articles/data-factory/connector-troubleshoot-mongodb.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Troubleshoot the mongodb connector
2+
title: Troubleshoot the MongoDB connector
33
titleSuffix: Azure Data Factory & Azure Synapse
4-
description: Learn how to troubleshoot issues with the mongodb connector in Azure Data Factory and Azure Synapse Analytics.
4+
description: Learn how to troubleshoot issues with the MongoDB connector in Azure Data Factory and Azure Synapse Analytics.
55
author: jianleishen
66
ms.service: data-factory
77
ms.subservice: data-movement
88
ms.topic: troubleshooting
9-
ms.date: 12/02/2022
9+
ms.date: 07/24/2023
1010
ms.author: jianleishen
1111
ms.custom: has-adal-ref, synapse
1212
---
@@ -28,6 +28,18 @@ This article provides suggestions to troubleshoot common problems with the Mongo
2828

2929
- **Resolution**: In the MongoDB connection string, add the *uuidRepresentation=standard* option. For more information, see [MongoDB connection string](connector-mongodb.md#linked-service-properties).
3030

31+
## Migrate to the new version of MongoDB connector
32+
33+
- **Symptoms**: You meet the following error code and error message:
34+
- **Error code**: `DeprecatedMongoDbOdbcConnector`
35+
- **Error message**: `The legacy MongoDB connector has been deprecated. To ensure your pipeline works, please create a new MongoDB linked service. Detailed instructions can be found in this documentation: https://learn.microsoft.com/azure/data-factory/connector-mongodb#upgrade-the-mongodb-linked-service`
36+
37+
- **Cause**:
38+
Your pipeline is still running on a legacy MongoDB connector that causes the error.
39+
40+
- **Resolution**:
41+
Upgrade your MongoDB linked service to the latest version. Refer to this [article](connector-mongodb.md#upgrade-the-mongodb-linked-service).
42+
3143
## Next steps
3244

3345
For more troubleshooting help, try these resources:

0 commit comments

Comments
 (0)