How to fix MongoDB warnings All In One

How to fix MongoDB warnings All In One

warnings

$ ➜  api-master git:(api) ✗ yarn final
yarn run v1.22.19
$ nodemon final/index.js
[nodemon] 1.18.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node final/index.js`
(node:46673) Warning: Accessing non-existent property 'count' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:46673) Warning: Accessing non-existent property 'findOne' of module exports inside circular dependency
(node:46673) Warning: Accessing non-existent property 'remove' of module exports inside circular dependency
(node:46673) Warning: Accessing non-existent property 'updateOne' of module exports inside circular dependency
GraphQL Server running at http://localhost:4000/api


solution

Node.js version bug

# 14.x => 16.x ❓

# ❌
$ npm update

# ❌
$ npm uninstall mongoose
$ npm i mongoose


https://stackoverflow.com/questions/61406974/how-to-clear-warnings-in-node-js-while-using-mongoose

demos

http://localhost:4000/api

image

$ mongo

> show dbs;

> show databases;
> show collections;

> db.test.insert({name: 'webfullstack'});
> db.test.save({name: 'webgeeker'});
> db.test.insert({name: 'xgqfrms'});

> db.test.find({name: 'webfullstack'});
> db.test.find();
> db.test.find().pretty();





https://www.runoob.com/mongodb/mongodb-databases-documents-collections.html

https://www.runoob.com/mongodb/mongodb-query.html

VSCode & MongoDB client

https://marketplace.visualstudio.com/items?itemName=cweijan.vscode-database-client2

https://marketplace.visualstudio.com/items?itemName=cweijan.vscode-mysql-client2

db('notedly').collection('test').find({}).skip(0).limit(1).toArray()

db('notedly').collection('test').find({}).skip(1).limit(10).toArray()

(🐞 反爬蟲測試!打擊盜版⚠️)如果你看到這個信息, 說明這是一篇剽竊的文章,請訪問 https://www.cnblogs.com/xgqfrms/ 查看原創文章!

refs



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 發佈文章使用:只允許註冊用戶纔可以訪問!

原創文章,版權所有©️xgqfrms, 禁止轉載 🈲️,侵權必究⚠️!


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章