fix: 修复 MongoDB 筛选查询预览语法 (#1989)
Co-authored-by: staff <staff@qimaos-MacBook-Pro.local>
This commit is contained in:
1 parent
73120883b6
commit
55cd442cdb
2 files changed
+4
-2
No files matched your search
@@ -47,7 +47,8 @@ const mongoDocumentProvider: DocumentStoreProvider = {
|
||||
sortInputLabel: "sort",
|
||||
documentsLabel: ({ total, t }) => t("mongo.documents", { count: total }),
|
||||
queryPreview: ({ collection, filterJson, sortJson, skip, limit }) => {
|
||||
const parts = [`db.${collection}.find(${filterJson || "{}"})`];
|
||||
const collectionRef = `db.getCollection(${JSON.stringify(collection)})`;
|
||||
const parts = [`${collectionRef}.find(${filterJson || "{}"})`];
|
||||
if (sortJson?.trim()) parts.push(`.sort(${sortJson.trim()})`);
|
||||
parts.push(`.skip(${skip}).limit(${limit})`);
|
||||
return parts.join("");
|
||||
|
||||
Reference in new issue
Block a user