小编raj*_*aju的帖子

MongoDb如何按月和年汇总

我是mongodb的新手并且正在尝试学习Mongodb查询

    {
    "_id" : ObjectId("59815d4704ca1760a45957ca"),
    "userEmail" : "lk@gmail.com",
    "expenseAmount" : 200,
    "expenseRemark" : "aa",
    "expenseCategory" : "billing",
    "entryTime" : ISODate("2017-08-02T05:03:57Z"),
    "__v" : 0
}
{
    "_id" : ObjectId("59815d5404ca1760a45957cb"),
    "userEmail" : "lk@gmail.com",
    "expenseAmount" : 300,
    "expenseRemark" : "ff",
    "expenseCategory" : "transport",
    "entryTime" : ISODate("2017-08-02T05:04:11Z"),
    "__v" : 0
}
{
    "_id" : ObjectId("5980191d04ca1760a45957cd"),
    "userEmail" : "lk@gmail.com",
    "expenseAmount" : 100,
    "expenseRemark" : "rr",
    "expenseCategory" : "billing",
    "entryTime" : ISODate("2017-08-01T06:00:46Z"),
    "__v" : 0
}
{
    "_id" : ObjectId("5980192604ca1760a45957ce"),
    "userEmail" : "lk@gmail.com",
    "expenseAmount" : 200, …
Run Code Online (Sandbox Code Playgroud)

aggregate mongodb

5
推荐指数
1
解决办法
7114
查看次数

如何使用Angular 6拦截器更改http req url

我正在学习Angular6 Http和拦截器。

我创建了一个拦截器

@Injectable()
export class HttpsRequestInterceptor implements HttpInterceptor {
  intercept(
    req: HttpRequest<any>,
    next: HttpHandler
  ): Observable<HttpEvent<any>> {
    console.log(req);
    if(req.url == 'https://abcd.azure.net/api/v1/getPendinList') {
      // return Observable.empty();
      console.log('hello')
    }
    const dupReq = req.clone({
      headers: req.headers.set('Consumer-Secret', 'some sample key')
    });
     return next.handle(dupReq);
  }
}
Run Code Online (Sandbox Code Playgroud)

每当我点击时,我都会获得console.log,这很好https://abcd.azure.net/api/v1/getPendinList。我要尝试实现的是,如果我点击此URL,我想将此URL更改为其他名称,例如abcd.api.com/search。这样我的url从新端点获取数据。

这可能吗?

angular

5
推荐指数
3
解决办法
6368
查看次数

如何替换字符串中的第一个字符

我在 VBA 中有一个字符串- Hello how are you

我想-用别的东西代替。我怎样才能做到这一点?我从 VBA 开始。需要帮忙。

excel vba

4
推荐指数
2
解决办法
8781
查看次数

如何根据给定的索引值将大数组拆分为更小的数组,

我有一个大阵列,例如 aa=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]

我有另一个数组,它根据需要分块的大数组来保存索引值.例如cc=[10,16]

我希望将数组aa分成新的数组

dd [] = [从0到cc [0]索引]

ee [] = [从cc [0]索引到cc [下一个值]索引]

dd[] = [1,2,3,4,5,6,7,8,9,10]
ee[] = [11,12,13,14,15,16]
Run Code Online (Sandbox Code Playgroud)

等等,直到cc[]有索引

如果有人能帮助我,我无法弄清楚逻辑.

javascript arrays

4
推荐指数
1
解决办法
60
查看次数

AWS Lambda Serverless部署要求AWS提供者凭证

我已经用密钥和机密配置了无服务器。

当我尝试运行无服务器部署时,它说:

ServerlessError: AWS provider credentials not found. Learn how to set up AWS provider credentials in our docs here:.
Run Code Online (Sandbox Code Playgroud)

请帮我怎么办

amazon-web-services aws-lambda

4
推荐指数
2
解决办法
1643
查看次数

检查函数是否被调用,Angular 单元测试

我在 ngOnInit 中调用了一个函数,

ngOnInit() {
 this.isSubscribable();
}
Run Code Online (Sandbox Code Playgroud)

我想像这样对此 ngOnInit 进行单元测试:

    it('Check isSubscribable is called from ngOnInit', async(async() => {
      spyOn(component, 'isSubscribable').and.callThrough();
      fixture.detectChanges();
      await fixture.whenStable();
      expect(component.isSubscribable).toHaveBeenCalled();

    }))
Run Code Online (Sandbox Code Playgroud)

这是行不通的。我需要一些帮助。

jasmine angular

4
推荐指数
1
解决办法
5725
查看次数

警告:在 StrictMode 中不推荐使用 findDOMNode,react-redux-notify

我在使用react-redux-notify时收到此警告

index.js:1 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of CSSTransitionGroupChild which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: ---/react-strict-mode-find-node
    in div (created by Notification)
    in Notification (created by Notify)
    in CSSTransitionGroupChild (created by TransitionGroup)
    in div (created by TransitionGroup)
    in TransitionGroup (created by CSSTransitionGroup)
    in CSSTransitionGroup (created by Notify)
    in div (created by Notify)
    in Notify (created by …
Run Code Online (Sandbox Code Playgroud)

strict-mode reactjs deprecation-warning react-redux react-redux-notify

4
推荐指数
2
解决办法
1万
查看次数

在 NX monorepo Angular 中运行 ionic 生成页面

我在 NX monorepo 中,它在 Angular 上工作。

我已经按照链接上给出的预先说明安装了 Ionic 。Ionic 工作正常,但我无法使用类似命令ionic generate page --project=sales-app,我收到类似错误,An unhandled exception occurred: Schematic "page" not found in collection "@nrwl/angular".

请帮忙,如何解决这个问题。

nomachine-nx ionic-framework monorepo angular

4
推荐指数
1
解决办法
911
查看次数

如何使用“@”符号导入模块,Node+Express+Typescript

我对 Node+Typescript 比较陌生,我有一个使用这样导入另一个文件模块的文件import { IS_PRODUCTION } from '@/config/config';,我无法理解它是如何通过@符号导入的。

需要一些帮助来理解这一点。

谢谢

[编辑]:这是 tsconfig.json

{
  "compilerOptions": {
    "esModuleInterop": true,
    "target": "es2018",
    "noImplicitAny": true,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "sourceMap": true,
    "outDir": "build",
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"],
      "@@/*": ["./*"]
    },
    "module": "commonjs",
    "skipLibCheck": true
  },
  "include": ["src/**/*"],
  "exclude": ["build", "node_modules"]
}
Run Code Online (Sandbox Code Playgroud)

node.js express typescript

4
推荐指数
1
解决办法
3982
查看次数

离子电容器本地通知

我正在尝试实现 Capacitor LocalNotification 插件。

\n
import { Plugins, CameraResultType } from '@capacitor/core';\nconst { LocalNotifications } = Plugins;\n
Run Code Online (Sandbox Code Playgroud)\n

在下面的代码中就像

\n
 schedule() {\n    console.log('----')\n    LocalNotifications.schedule({\n      notifications: [\n        {\n          title: "aaaa",\n          body: "Body",\n          id: 1,\n          smallIcon: 'house',\n          actionTypeId: 'OPEN_PRODUCT',\n          \n          schedule: {\n            every: "minute"\n          },\n\n          extra: null\n        }\n      ]\n    });\n  }\n
Run Code Online (Sandbox Code Playgroud)\n

我正在 ios 模拟器上进行测试,该方法被调用,在 Xcode-debug 中我得到这样的结果:

\n
   To Native ->  LocalNotifications schedule 1850642\n\xe2\x9a\xa1\xef\xb8\x8f  TO JS {"notifications":[{"id":"1"}]\n
Run Code Online (Sandbox Code Playgroud)\n

但模拟器中未显示通知。

\n

我在这个项目中没有使用 cordova/ionic-native 。如果我需要运行一些 npm 包等才能使其正常工作,请提供帮助。

\n

typescript ionic-framework angular capacitor

3
推荐指数
1
解决办法
5855
查看次数