With "fluff" and returns the result as an array of kittens to the callback. This performs a search for all documents with a name property that begins const kittySchema = new mongoose.Schema() Let's get a reference to it and define our kittens. With Mongoose, everything is derived from a Schema. getting-started.js const mongoose = require( 'mongoose') Īwait nnect( 'mongodb://localhost:27017/test') įor brevity, let's assume that all following code is within the main() function. The first thing we need to do is include mongoose in our project and open aĬonnection to the test database on our locally running instance of MongoDB. Now say we like fuzzy kittens and want to record every kitten we ever meet Next install Mongoose from the command line using npm: $ npm install mongoose -save First be sure you have MongoDB and Node.js installed.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |