db.getCollection('merged_authors').find({last_name:
'Wang','first_name': {'$regex': 'Junmin'}, user_id:{$exists:true} })
router.get('/merged_author/', function (req, res, next) {
var first_name = req.query.first_name;
var last_name = req.query.last_name;
var full_name = req.query.full_name;
var middle_name = req.query.middle_name;
var page = req.query.page;
if (page == null) {
page = 1;
}
var per_page = req.query.per_page;
if (per_page == null) {
per_page = 25;
}
var name_results = [];
var condition = {};
if (first_name != undefined) {
condition_first_name ={};
condition_first_name["$regex"] = first_name;
condition["first_name"] = condition_first_name;
}
if (last_name != undefined) {
condition["last_name"] = last_name;
}
if (middle_name != undefined) {
condition["middle_name"] = middle_name;
}
condition["user_id"] = {$exists: true};
console.log(condition);
KMMergedAuthors.find(condition)
.sort(
buildSortClause(req)
)
.limit(50)
.exec()
.then(function (allMergedAuthors) {
res.json(allMergedAuthors);
});
});
No comments:
Post a Comment