Skip to content

Commit

Permalink
queries
Browse files Browse the repository at this point in the history
  • Loading branch information
sspathare97 committed Apr 12, 2022
1 parent 54811f5 commit 925690f
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions extras/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ db.article.aggregate([
{
$match: { uri: 'nyt://article/f9171427-eed3-5031-88fa-f3ba050a5cf3' }
}
])
]);

db.article.aggregate([
{
Expand All @@ -111,5 +111,24 @@ db.article.aggregate([
foreignField: "location",
as: "locations"
}
}
])
},
{ $project: { _id: 0, locationsRawTrimmed: 0, "locations._id": 0 } },
{ $out: "article_loc" }
]);

db.article.aggregate([
{
$lookup:
{
from: "location",
localField: "locationsRawTrimmed",
foreignField: "location",
as: "locations"
}
},
{ $project: { _id: 0, locationsRawTrimmed: 0, "locations._id": 0 } },
{ $out: "article_loc" }
]);

db.article.drop();
db.article_loc.renameCollection('article');

0 comments on commit 925690f

Please sign in to comment.