Created
January 23, 2019 03:15
-
-
Save yashwanth2804/252b384fd25d8d0eebd6d388f024170a to your computer and use it in GitHub Desktop.
mongodb import and querys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./mongoimport --db dbname --collection coll --type csv --headerline --file path/restaurantsa9126b3.csv | |
Aggregate | |
await Restaurants | |
.aggregate([ | |
{ | |
$lookup: { | |
from: "restaurantsAdd", // collection name in db | |
localField: "Restaurant ID", | |
foreignField: "Restaurant ID", | |
as: "restaurantsAdd" | |
} | |
}, | |
{ $match: { "Restaurant Name": { $regex: Res_Name, $options: 'i' } } }, | |
{ $match: { "Cuisines": { $regex: Cuisines, $options: 'i' } } }, | |
{ $sort: { [sort]: sortOrder } } | |
]) | |
.skip(skip) | |
.limit(10) | |
.exec(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment