Fix bugs in resources download

Fix a bug caused when downloading with smart query filter on. Also
fix a bug in downloading presets.
This commit is contained in:
Shweelan Samson authored and Zaid Abdulla committed 2019-03-04 16:12:39 -08:00
1 parent 3b3369a236
commit d70263e798
7 files changed
+26 -22

No files matched your search

+9 -5
View File
@@ -101,11 +101,15 @@ export function query(
.collection(RESOURCE_COLLECTION[resource] || resource);
const cursor = collection.find(q);
if (options.projection) {
cursor.project(
resource === "devices"
? mongodbFunctions.processDeviceProjection(options.projection)
: options.projection
);
let projection = options.projection;
if (resource === "devices") {
projection = mongodbFunctions.processDeviceProjection(
options.projection
);
}
if (resource === "presets") projection.configurations = 1;
cursor.project(projection);
}
if (resource === "users") cursor.project({ password: 0 });