我正在尝试$lookup在集合中执行一个操作并将一些数据添加到我的文档中。问题是,当我尝试$lookup通过_id它匹配我的管道时,它返回一个空数组。这是我的代码:
Schedule.aggregate([{ // My Schedule schema
$match: {
store: req.query.store,
"customer.id": req.query.user
}
},
{
$skip: +req.query.skip
}, {
$limit: +req.query.limit
},
{
$lookup: {
from: Employee.collection.name, // "employee" schema,
let: {
id: "$employee.id" // employee _id from the "schedule" collection match above
},
pipeline: [{
$match: {
$expr: {
"_id": "$$id" // here i try to match by _id
}
}
},
{
$project: { // the only fields i need
"_id": 1, …Run Code Online (Sandbox Code Playgroud) 我正在尝试为datepickers实现min和max属性。所以我有两个日期选择器,一个选择开始,另一个选择结束,都选择小时和分钟
<ion-row>
<ion-col width-45>
<ion-item>
<ion-datetime formControlName="start" displayFormat="HH:mm" min="{{minStart}}" max="{{maxStart}}" pickerFormat="HH mm" doneText="Ok" cancelText="Cancelar" (ionChange)="changeHours()"></ion-datetime>
</ion-item>
</ion-col>
<ion-col width-45>
<ion-item>
<ion-datetime formControlName="end" displayFormat="HH:mm" min="{{minEnd}}" max="{{maxEnd}}" pickerFormat="HH mm" doneText="Ok" cancelText="Cancelar" (ionChange)="changeHours()"></ion-datetime>
</ion-item>
</ion-col>
</ion-row>
Run Code Online (Sandbox Code Playgroud)
在我的ts文件中,我具有changeHours()用于更新最小值和最大值的变量,而我Moment.js用于创建和操作日期
minDate: string = Moment().toDate().toISOString(); // i'm using this for other stuff too
minStart: string = Moment().toDate().toISOString();
maxStart: string = Moment().toDate().toISOString();
minEnd: string = Moment().toDate().toISOString();
maxEnd: string = Moment().format('YYYY-MM-DDT') + '23:59';
changeHours() {
let start= this.novoAtendimento.get('start').value;
let end= this.novoAtendimento.get('end').value;
if (ini != null …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过cordova-fcm-plugin使用我的Ionic 2应用程序进行FCM推送通知.
我已经按照每个教程进行操作,当我从firebase控制台发送推送时它工作正常,但我想在我的应用程序中使用其功能和有效负载做一些事情,但当我尝试使用插件中的任何方法时,我得到a 在Visual Studio上找不到名称"FCMPlugin"错误: 错误 我一直在寻找如何正确使用它并且没有找到任何内容,只是这个问题:问题
那么实现和使用插件的正确方法是什么?有模块吗?我可以用'离子原生'来称它吗?我必须从某个地方导入它?只需使用index.html中的插件.js文件链接?或者这个错误是普通的,在仿真/构建中它会正常工作吗?
感谢:D
PS:我没有尝试构建它或模仿它看看会发生什么,现在就去做.
好的,所以这是一个错误,不会让我构建我的应用程序.Rly现在需要知道如何使用插件.
我有这个html in ionic
<ion-label color="primary" stacked>Email</ion-label>
<ion-input type="email" placeholder="Email Input"></ion-input>
Run Code Online (Sandbox Code Playgroud)
如何在右侧进行文本输入对齐文本