summaryrefslogtreecommitdiff
path: root/src/api/common
diff options
context:
space:
mode:
authorotofune <otofune@gmail.com>2017-11-06 16:26:17 +0900
committerotofune <otofune@gmail.com>2017-11-06 16:26:17 +0900
commit4c5a4d259738ba617bf29d2158d180cc5fa8401c (patch)
tree72586ef0f230505d85b86b7994cfc4959abf43d5 /src/api/common
parentMongoDBの階層構造検索に関する思い違いの修正 (diff)
downloadsharkey-4c5a4d259738ba617bf29d2158d180cc5fa8401c.tar.gz
sharkey-4c5a4d259738ba617bf29d2158d180cc5fa8401c.tar.bz2
sharkey-4c5a4d259738ba617bf29d2158d180cc5fa8401c.zip
core - fix metadata searching
Diffstat (limited to 'src/api/common')
-rw-r--r--src/api/common/add-file-to-drive.ts6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/api/common/add-file-to-drive.ts b/src/api/common/add-file-to-drive.ts
index 376c470e93..1f882389ac 100644
--- a/src/api/common/add-file-to-drive.ts
+++ b/src/api/common/add-file-to-drive.ts
@@ -81,9 +81,7 @@ export default (
// Check if there is a file with the same hash
const much = await DriveFile.findOne({
md5: hash,
- metadata: {
- user_id: user._id
- }
+ 'metadata.user_id': user._id
});
if (much !== null) {
@@ -97,7 +95,7 @@ export default (
// Calculate drive usage
const usage = ((await DriveFile
.aggregate([
- { $match: { metadata: { user_id: user._id } } },
+ { $match: { 'metadata.user_id': user._id } },
{ $project: {
length: true
}},