{"id":22433107,"url":"https://github.com/roerohan/vscode-mongosnippets-nodejs","last_synced_at":"2025-08-01T12:33:59.338Z","repository":{"id":35784823,"uuid":"186711040","full_name":"roerohan/vscode-MongoSnippets-NodeJS","owner":"roerohan","description":"VSCode Extension - Mongo Snippets.","archived":false,"fork":false,"pushed_at":"2022-12-06T14:39:05.000Z","size":33006,"stargazers_count":16,"open_issues_count":7,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-03-03T06:49:20.869Z","etag":null,"topics":["hacktoberfest","hacktoberfest2019","hacktoberfest2020","hacktoberfest2021","javascript","javascript-tools","mongo","mongodb","mongoose","node","node-js","vscode","vscode-extension","vscode-plugin","vscode-snippets"],"latest_commit_sha":null,"homepage":"https://marketplace.visualstudio.com/items?itemName=roerohan.mongo-snippets-for-node-js","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roerohan.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"roerohan","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":["https://buymeacoffee.com/roerohan"]}},"created_at":"2019-05-14T22:43:38.000Z","updated_at":"2023-02-16T18:12:13.000Z","dependencies_parsed_at":"2023-01-16T06:30:34.439Z","dependency_job_id":null,"html_url":"https://github.com/roerohan/vscode-MongoSnippets-NodeJS","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roerohan%2Fvscode-MongoSnippets-NodeJS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roerohan%2Fvscode-MongoSnippets-NodeJS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roerohan%2Fvscode-MongoSnippets-NodeJS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roerohan%2Fvscode-MongoSnippets-NodeJS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roerohan","download_url":"https://codeload.github.com/roerohan/vscode-MongoSnippets-NodeJS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228377561,"owners_count":17910449,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","hacktoberfest2019","hacktoberfest2020","hacktoberfest2021","javascript","javascript-tools","mongo","mongodb","mongoose","node","node-js","vscode","vscode-extension","vscode-plugin","vscode-snippets"],"created_at":"2024-12-05T22:13:53.937Z","updated_at":"2024-12-05T22:13:54.572Z","avatar_url":"https://github.com/roerohan.png","language":"TypeScript","readme":"# Mongo Snippets\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\n\u003e vscode-id: [roerohan.mongo-snippets-for-node-js](https://marketplace.visualstudio.com/items?itemName=roerohan.mongo-snippets-for-node-js)\n\nThis Visual Studio Code extension is built for Node-js projects. It provides:\n- **Code Snippets** for MongoDB Connection and queries.\n- Command Palette Feature to **Set up Boilerplate Code**.\n- **Completion Suggestions** for Mongoose Models.\n- **Mongo Connect** directly from the editor.\n\n![example](./static/example.gif)\n\n## Table of Contents:\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Issues](#issues)\n- [User's Notes](#user's-notes)\n- [Release Notes](#release-notes)\n- [Contributing](#contributing)\n- [License](#license)\n- [More information](#for-more-information)\n\n## Features\n\n### **Command Palette:**\n\n\u003e Note: Ctrl+Shift+P or Command+Shift+P opens Command Palette in VSCode.\n\n- **Mongo Snippets: Refer to Mongoose Documentation**\n   * Opens the [Mongoose Documentation](https://mongoosejs.com/docs/api.html#Model) on a web browser.\n\n- **Mongo Snippets: Refer to Extension Documentation**\n   * Opens the [Repository](https://github.com/roerohan/vscode-MongoSnippets-NodeJS) on a web browser.\n\n- **Mongo Snippets: Set up Mongo Boilerplate Code**\n   * Creates folders named `routes` and `models` - if they do not exist - in the [`source directory`](#source-directory), and adds files containing boilerplate code.\n\n- **Mongo Snippets: Show Existing Models**\n   * Shows a list of names of models present in the `models` folder in the [`source directory`](#source-directory).\n   * Highlights the model definition in the file where it had been created.\n\n- **Mongo Snippets: View MongoDB Collection as JSON**\n\u003e Note: This is a beta feature and will be receive updates soon.\n   * Connect to a MongoDB instance using a connection string and view a DB as a JSON.\n\n### **Completion Suggestions:**\n\n\u003e Note: See User's Notes for details.\n\n- Model name suggestions:\n   * First it identifies the names of the models in a folder named models (if any) in the [`source directory`](#source-directory).\n   * It stores the model and field names and provides completion suggestions when you type.\n   * Suggests field names for models. E.G. if the model `User` has a field `name`, on typing `User.`, `name` is suggested.\n   * Field names are also suggested inside `{...}`.\n\n### **Snippets:**\n\nThe following are some of the snippets that can be generated with this extension.\n\n\u003e Note: Type the following snippets and press 'Tab' OR 'Ctrl/Command + Space; Enter' for auto-completion.\n\n|       **Type/No.**       |   **Snippet**  |        **Stands For**       |          **Function**          |\n|:------------------------:|:--------------:|:---------------------------:|:------------------------------:|\n|       **Generic:**       |                |                             |                                |\n|            1.            |    **!mdbc**   |       MongoDB Connect       |  MongoDB connect on port 27017 |\n|            2.            |   **!mdbgum**  | MongoDB Generate User Model |   Generate typical user model  |\n|            3.            |    **!mdba**   |      MongoDB Aggregate      |     *Model.aggregate* query    |\n|            4.            |   **!mdbcd**   |    MongoDB CountDocuments   |  *Model.countDocuments* query  |\n|            5.            |   **!mdbmr**   |      MongoDB MapReduce      |     *Model.mapReduce* query    |\n|            6.            |    **!mdbp**   |       MongoDB Populate      |     *Model.populate* query     |\n|            7.            |   **!mdbbw**   |      MongoDB BulkWrite      |     *Model.bulkWrite* query    |\n|    **Create/Insert:**    |                |                             |                                |\n|            1.            |   **!mdbcr**   |        MongoDB Create       |      *Model.create* query      |\n|            2.            |   **!mdbcc**   |   MongoDB CreateCollection  | *Model.createCollection* query |\n|            3.            |   **!mdbim**   |      MongoDB InsertMany     |    *Model.insertMany* query    |\n|         **Find:**        |                |                             |                                |\n|            1.            |    **!mdbf**   |         MongoDB Find        |       *Model.find* query       |\n|            2.            |   **!mdbfo**   |       MongoDB FindOne       |      *Model.findOne* query     |\n|            3.            |   **!mdbfbi**  |       MongoDB FindById      |     *Model.findById* query     |\n|        **Replace:**      |                |                             |                                |\n|            1.            |   **!mdbro**   |      MongoDB ReplaceOne     |     *Model.replaceOne* query   |\n|        **Update:**       |                |                             |                                |\n|            1.            |  **!mdbfoau**  |   MongoDB FindOneAndUpdate  | *Model.findOneAndUpdate* query |\n|            2.            |   **!mdbuo**   |      MongoDB UpdateOne      |     *Model.updateOne* query    |\n|            3.            |   **!mdbum**   |      MongoDB UpdateMany     |    *Model.updateMany* query    |\n|        **Delete:**       |                |                             |                                |\n|            1.            |  **!mdbfoad**  |   MongoDB FindOneAndDelete  | *Model.findOneAndDelete* query |\n|            2.            |   **!mdbdo**   |      MongoDB DeleteOne      |     *Model.deleteOne* query    |\n|            3.            |   **!mdbdm**   |      MongoDB DeleteMany     |    *Model.deleteMany* query    |\n| **Methods and Statics:** |                |                             |                                |\n|            1.            | **!mdbmethod** |       MongoDB Methods       |    *schema.methods.function*   |\n|            2.            | **!mdbstatic** |       MongoDB Statics       |    *schema.statics.function*   |\n\n\n## Requirements\n\n\u003e There are no dependencies for this extension to work, but it provides mongoose-js snippets, hence mongoose should be installed.\n\n- mongoose library from npm.\nThis can be installed by executing the following command in the folder where 'package.json' is present.\n```bash\nnpm install mongoose\n```\n\u003e Make sure mongoose is added as a dependency in package.json\n\n## Issues\n\nPlease report issues on [vscode-MongoSnippets-NodeJS](https://github.com/roerohan/vscode-MongoSnippets-NodeJS/issues).\n\n## User's Notes\n\n### Source Directory\n\n- The source directory, as mentioned multiple times, is by default the root directory of your workspace. It can be modified by adding the following to `.vscode/settings.json` in your workspace root directory.\n\n```json\n{\n   \"mongosnippets\": {\n      \"sourceDir\": \"src\"\n   }\n}\n```\n\n- The above line changes the `source directory` from the root directory of the workspace to a folder named `src` in the root directory.\n\n### Other\n\n- The boilerplate is set up in the `source directory` of the workspace. In order to set up the boilerplate code in a certain directory, that directory must be open in a new workspace. (Open the folder you want the boilerplate code in with VSCode).\n\n- Model name suggestions are only given for those models defined in files present in a directory called `models` in the `source directory` of the workspace. Folders with other names are not checked, hence models defined in them will not show up as suggestions.\n\n- In files where models are described, to be able to detect the models, mongoose must be imported as `mongoose` only. For example,\n   * const mongoose = require('mongoose');\n   * import mongoose from 'mongoose';\n\n- The model must be created in the models folder as follows:\n   * const modelName = mongoose.model('modelName', modelSchema)\n\n- Mongo Snippets: See Existing Models command shows models only in the `source directory` of the workspace.\n\n- For field name suggestions, each model should be exported in a seperate file, and the file should not have errors.\n\n## Release Notes\n\nThese are the release notes for mongo-snippets-for-node-js.\n\n### v1.3.5\n\n- Fix:\n  * Bump lodash to newer version.\n\n### v1.3.4\n\n- Fix:\n   * GitHub release action issues fixed.\n\n### v1.3.3\n\n- Feat:\n   * GitHub release action added.\n\n### v1.3.2\n\n- Feat:\n   * Use VSCE to publish.\n   * Publish using GitHub actions.\n\n### v1.3.1\n\n- Fix:\n   * CompletionItemProvider code optimization.\n   * General working of the extension.\n\n### v1.3.0\n\n- Feat:\n   * Get `sourceDir` from `.vscode/settings.json` under key `mongosnippets`.\n\n- Fix:\n   * Set up boilerplate, make folders awaited.\n\n### v1.2.5\n\n- Refactor:\n   * Lots of code refactor, remove lint warnings and errors.\n   * Code quality improvements.\n\n- Feat:\n   * Code should run faster now.\n   * Should take lesser processing power.\n   * Typescript support for existing features.\n\n-----------------------------------------------------------------------------------------------------------\n\n## Contributing\n\nYou can contribute to mongo-snippets-for-node-js on the GitHub page [vscode-MongoSnippets-NodeJS](https://github.com/roerohan/vscode-MongoSnippets-NodeJS). Checkout [CONTRIBUTING.md](https://github.com/roerohan/vscode-MongoSnippets-NodeJS/blob/master/CONTRIBUTING.md) for further details.\n\n## License\n\nClick the following hyperlink to view the license.\n* [MIT License](https://github.com/roerohan/vscode-MongoSnippets-NodeJS/blob/master/LICENSE)\n\n### For more information\n\nYou can checkout the source code and contribute on:\n\n* [vscode-MongoSnippets-NodeJS](https://github.com/roerohan/vscode-MongoSnippets-NodeJS)\n\n**Enjoy!**\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e \n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/roerohan\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/42958812?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eRohan Mukherjee\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/roerohan/vscode-MongoSnippets-NodeJS/commits?author=roerohan\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/roerohan/vscode-MongoSnippets-NodeJS/commits?author=roerohan\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#infra-roerohan\" title=\"Infrastructure (Hosting, Build-Tools, etc)\"\u003e🚇\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://github.com/jvmolu\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/44413960?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eAnmol Singhal\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/roerohan/vscode-MongoSnippets-NodeJS/commits?author=jvmolu\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/roerohan/vscode-MongoSnippets-NodeJS/commits?author=jvmolu\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","funding_links":["https://ko-fi.com/roerohan","https://buymeacoffee.com/roerohan"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froerohan%2Fvscode-mongosnippets-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froerohan%2Fvscode-mongosnippets-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froerohan%2Fvscode-mongosnippets-nodejs/lists"}