All Categories

  • How to Delete Data from MongoDB with Node.js and Mongoose

    8/11/2020 -
    This blog will show a tutorial about how to delete data from MongoDB by using Node.js with Mongoose. Mongoose is the Object Data Modeling library for MongoDB and Node.js. It provides functions for schema, query building, and more. If you don't use Mongoose to access MongoDB with Node.js, then you can use the MongoDB package for Node.js directly.  Get Start First, initialize a new npm package, we'll create a new package and new file, and add our code for how to insert data to MongoDB. npm init -y Next, let's install the mongoose package, this will be the only package we'll use for this tutorial.  npm install --save mongoose Create an index.js, we'll add our code to this file to connect to MongoDB and insert data to the Database. Connect to the MongoDB Now, the following is a sample code to connect to MongoDB.
    MongoDBNode.jsMongoose
  • How to Insert Data into MongoDB with Node.js and Mongoose

    7/11/2020 -
    This blog will show a tutorial about how to insert data into MongoDB by using Node.js with Mongoose. Mongoose is the Object Data Modeling library for MongoDB and Node.js. It provides functions for schema, query building, and more. If you don't use Mongoose to access MongoDB with Node.js, then you can use the MongoDB package for Node.js directly.  Get Start First, initialize a new npm package, we'll create a new package and new file, and add our code for how to insert data to MongoDB. npm init -y Next, let's install the mongoose package, this will be the only package we'll use for this tutorial.  npm install --save mongoose Create an index.js, we'll add our code to this file to connect to MongoDB and insert data to the Database. Connect to the MongoDB Now, the following is a sample code to connect to MongoDB.
    Node.jsMongooseMongoDB
  • How to Find Record from MongoDB with Node.js and Mongoose

    9/11/2020 -
    This blog will show a tutorial about how to find data into MongoDB by using Node.js with Mongoose. Mongoose is the Object Data Modeling library for MongoDB and Node.js. It provides functions for schema, query building, and more. If you don't use Mongoose to access MongoDB with Node.js, then you can use the MongoDB package for Node.js directly.  Get Start First, initialize a new npm package, we'll create a new package and new file, and add our code for how to insert data to MongoDB. npm init -y Next, let's install the mongoose package, this will be the only package we'll use for this tutorial.  npm install --save mongoose Create an index.js, we'll add our code to this file to connect to MongoDB and insert data to the Database. Connect to the MongoDB Now, the following is a sample code to connect to MongoDB.
    Node.jsMongooseMongoDB
  • How to Setup MongoDB on Windows

    2/3/2021 -
    This blog shows how to set up MongoDB 4.4 Community version on windows 10 as a local development environment, create a simple database, table, and collection, and how to backup and store data by using mongoexport and mongoimport. Install MongoDB Server First, go to the official MongoDB installation link here to download the installation file. After the download following the installation wizard to install MongoDB.  Choose Location The default location is under windows' C drive, you can modify the location to other places. I'm using the D:\MongoDB on this blog. Choose Install MongoDB as Service If you choose to install MongoDB as a service, the installation will create a windows service so the MongoDB will be running as background. I think most of the time you should choose.
    MongoDB
  • How to Setup MongoDB on Mac

    7/11/2020 -
    This blog shows how to set up MongoDB 4.4 Community version on Mac OS, also will create a simple database, table, and collection, and how to backup and store data by using mongoexport and mongoimport. Install MongoDB Server Install MongoDB on Mac is a little different compare to the Mac, you'll need brew to install the MongoDB, on this blog assume brew is already installed on Mac. Download Homebrew formula for MongoDB brew tap mongodb/brew Install MongoDB in macOS brew install mongodb-community@4.4 Install MongoDB Tools Starting from MongoDB 4.4, use brew will also install the mongodump, mongoexport, mongoimport and some other commands. Install MongoDB Compass MongoDB Compass is the GUI tool, you should install on your local development environment so you can connect to the MongoDB server and run the query from GUI.
    MongoDB
  • How to Setup MongoDB on Amazon Linux EC2

    2/11/2020 -
    This blog shows how to set up a MongoDB database environment on the cloud, AWS EC2 with Amazon Linux.  Pre requirement You'll need an AWS account, if you never set up an AWS account before, go here to create an AWS account. Create EC2 Instance First, we'll need to set up an EC2 instance, then we'll SSH into the EC2 instance and set up the MongoDB database. Create EC2 Instance with AWS Linux AMI. Choose t2.micro. During the setup everything as default is fine for this blog, we'll use default VPC, as long as the new EC2 can access the internet.  For the security group, we'll just open port 22, so we can SSH later to into EC2 for setup MongoDB.
    MongoDBEC2Linux
  • How to Update MongoDB Data with Node.js and Mongoose

    8/11/2020 -
    This blog will show a tutorial about how to update data into MongoDB by using Node.js with Mongoose. Mongoose is the Object Data Modeling library for MongoDB and Node.js. It provides functions for schema, query building, and more. If you don't use Mongoose to access MongoDB with Node.js, then you can use the MongoDB package for Node.js directly.  Get Start First, initialize a new npm package, we'll create a new package and new file, and add our code for how to insert data to MongoDB. npm init -y Next, let's install the mongoose package, this will be the only package we'll use for this tutorial.  npm install --save mongoose Create an index.js, we'll add our code to this file to connect to MongoDB and insert data to the Database. Connect to the MongoDB Now, the following is a sample code to connect to MongoDB.
    Node.jsMongoDBMongoose
  • Few GUI App to Use MongoDB at Windows

    5/4/2014 -
    List of Free Mongodb Management tools.
    MongoDB
  • How to perform Geospatial Queries by Using MongoDB with C#

    8/3/2014
    MongoDBC#
  • Mongodb 2.6 upgrade

    8/3/2014 -
    how to upgrade mongodb from 2.4 to 2.
    MongoDBMongoose
  • Few Commands about How to Export/Import MongoDB Collections

    6/1/2014 -
    Following example is export/import to your localhost's mongo database. Export Collection from Mongo Database Mongodb/bin>mongoexport --db {your database} --collection {your collection} --out {your file name}.json Import Collection to Mongo Database Mongodb/bin>mongoimport --db {your database} --collection {your collection} --file {your file name}.json For detail information, reference following mongo document.
    MongoDB
  • How To Implement Mongodb TextSearch with C#

    2/1/2015
    MongoDBC#
  • How to Setup MongoDB on Windows Service

    8/3/2014 -
    This blog shows how to install simply install and use mongoDB.
    MongoDB
  • Code Snippet - How to Add Index to Document at MongoDB C#

    3/2/2014 -
    // add index to document's field collection.CreateIndex(IndexKeys.Ascending(_ => _.FieldName)); // add index to subdocument's field collection.CreateIndex("SubDocument.
    MongoDB
  • How to Setup MongoDB Text Search with Node.js

    3/20/2016 -
    How to use MongoDB text search MongoDB provide text search function since 2.4, this blog will show how to use mongodb text search. All the example at following is run based on MongoDB version, 3.0.5. Also, I'm using Robomongo (0.8.5) to run all the MongoDB command. I also have code snippet about how to use Mongoose with text search, but I recommend at least use 2.6, seems like 2.4 with Mongoose has some problem. Stop Words, Stemming in MongoDB text search Before jump into how to use MongoDB text search, we need to understand how MongoDB do stop words and stemming. Stop in MongoDB is, let's say you have "I like apple", stop wold will be apple. Stemming is like "cook cooking cooks", so MongoDB text engine will index cook. I like apple, also I enjoy cooking.
    MongoDBMongooseNode.js
  • How to Use MongoDB TextSearch by Mongoose

    8/3/2014
    MongooseMongoDBNode.jsC#
  • How to Create Your First Nuget Package

    10/4/2014
    MongoDBNuget
  • Few Tips for MongoDB

    5/3/2014
    MongoDB
  • Few Commands about Import/Export Mongo Database

    5/11/2014 -
    With mongodb's mongodump & mongorestore command, you can achieve export and import data to your mongo database. 1. Export Database Go to your local mongo bin folder. Type mongodump --db {your database name} This command will export all your database as binary file under dump folder. When I have 200 MB, totall collection around 50,000. This command run like 2,3 second in my Windows 8 (8GB memory) PC. If you're connect to remote mongo db, following command could be use. mongodb\bin>mongodump --db {your database} --host {your host server name} --port {host server port number} --usernmae {mongodb username} --password {mongodb userpassword}   2. Restore you database to the remote connected database Asume your remote mongo database have nothing, you just want to import everything you just export from local mongo datatabase. Run following command.
    MongoDB