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
$ 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/ 查看原创文章!
macOS 13 & MongoDB
mongodb-community@4.2
# brew services
$ brew services list
Name Status User File
httpd started xgqfrms-mm ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
mongodb-community@4.2 started xgqfrms-mm ~/Library/LaunchAgents/homebrew.mxcl.mongodb-community@4.2.plist
php none
# brew services stop
$ brew services stop mongodb-community@4.2
Stopping `mongodb-community@4.2`... (might take a while)
==> Successfully stopped `mongodb-community@4.2` (label: homebrew.mxcl.mongodb-community@
$ brew services list
Name Status User File
httpd started xgqfrms-mm ~/Library/LaunchAgents/homebrew.mxcl.httpd.plist
mongodb-community@4.2 none
php none
# brew services start
$ brew services start mongodb-community@4.2
# brew services restart
$ brew services restart mongodb-community@4.2
$ mongo
refs
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/16965739.html
未经授权禁止转载,违者必究!