Closed yrj-essential closed 4 years ago
this.get(collectionName).push(JSON).write();
after useing “insert ” method, auto increment ID is added.
this.get(collectionName). Insert (JSON). Write ()
没有自增id的原因是,插入数据时使用的是push方法:
this.get(collectionName).push(json).write();
用insert方法后,能生成自增id了。
this.get(collectionName).insert(json).write();
create d.ts file,
declare module 'lodash-id'
create d.ts file,
declare module 'lodash-id'
Thanks for your reply.
Framework: egg.js
const lodashid = require('lodash-id'); In this way, lodash-id is introduced to provide a unique id, but the module or declaration file cannot be found. What should I do?
I have tried the following:
Create a shims-lodashid.d.ts under the root directory and declare the module. declare module'lodash-id'; Although there is no prompt that the module cannot be found, lodashid has not been added successfully.
Change the import address to an absolute address: const lodashid = require('E:/nodeStudy/egg-weibo/node_modules/lodash-id/src/index.js'); Still prompted that the module could not be found.
Create tsconfig.json under the root directory and set "noImplicitAny" to false. It didn't work either.
框架:egg.js const lodashid = require('lodash-id'); 这样引入lodash-id来提供唯一id,但是找不到模块或申明文件,该如何处理呢?
我做了以下尝试:
在根文件下创建一个shims-lodashid.d.ts,并申明模块。 declare module 'lodash-id'; 虽然没有提示找不到模块了,但是lodashid并没有添加成功。
将引入地址改为绝对地址: const lodashid = require('E:/nodeStudy/egg-weibo/node_modules/lodash-id/src/index.js'); 仍然提示找不到模块。
在根目录下创建tsconfig.json,并将“noImplicitAny”设为false。也没有用。