mongoose   505

« earlier    

Introduction to Mongoose for MongoDB – freeCodeCamp
Mongoose is an Object Data Modeling (ODM) library for MongoDB and NodeJS. It manages relationships between data, provides schema validation, and is used to translate between objects in code and the…
mongoose 
14 days ago by narven
Using Async/Await with Mocha, Express, and Mongoose | www.thecodebarbarian.com
One great perk of async/await in Node.js is how well it integrates with existing libraries. By now, most popular Node.js libraries support some sort of promise-based API, so they integrate nicely with async/await. You might even have the pleasure of removing a few dependencies from your package.json if you start using async/await instead of co. In this article, I'll show you how async/await works with mocha tests, express routes and middleware, and mongoose queries and cursors.
async  await  node  express  mongoose  mongodb  cursor  queries  post 
7 weeks ago by eugenexxv
An 80/20 Guide to Mongoose Discriminators | www.thecodebarbarian.com
Discriminators are a powerful yet unfortunately poorly documented feature of mongoose. Discriminators enable you to store documents with slightly different schemas in the same collection and query them back in a consistent way. In this article, you'll learn about how to use discriminators to store different types of events. You'll also see how to use the aggregation framework to run rudimentary analyses.
post  mongoose  mongodb  database  discriminator  webdev 
9 weeks ago by eugenexxv
Mongoose v5.0.17: Discriminators
Discriminators are a schema inheritance mechanism. They enable you to have multiple models with overlapping schemas on top of the same underlying MongoDB collection.

Suppose you wanted to track different types of events in a single collection. Every event will have a timestamp, but events that represent clicked links should have a URL. You can achieve this using the model.discriminator() function. This function takes 2 parameters, a model name and a discriminator schema. It returns a model whose schema is the union of the base schema and the discriminator schema.
documentation  mongoose  mongodb  discriminator 
9 weeks ago by eugenexxv
Getting started with Mongoose discriminators in Express.js
So for this rewrite, I wanted to dig a little deeper in storing data and stop relying on behind-the-scenes magic. This means coming up with a proper data model. I wanted a NoSQL database for flexibility (I might need to add different collection types later!). I opted for MongoDB because it meshes well with Node, and because I wanted to try MongooseJS (looking at the docs, it seemed to provide an easy to understand abstraction layer and spoiler alert: it is pretty neat).
mongodb  mongoose  discriminator  database  webdev 
9 weeks ago by eugenexxv
javascript - Multiple schema references in single schema array - mongoose - Stack Overflow
What you are looking for here is the mongoose .discriminator() method. This basically allows you to store objects of different types in the same collection, but have them as distinquishable first class objects.

Note that the "same collection" principle here is important to how .populate() works and the definition of the reference in the containing model. Since you really can only point to "one" model for a reference anyway, but there is some other magic that can make one model appear as many.
mongodb  mongoose  schema  database  referencing  discriminator  advice 
9 weeks ago by eugenexxv
mongoose: Referencing schema in properties or arrays | Alexander Zeitler
When using a NoSQL database like MongoDb, most of the time you'll have documents that contain all properties by itself. But there are also scenarios where you might encounter the need for a more relational approach and need to reference other documents by the ObjectIds.

This post will show you how to deal with these references using Node.js and the mongoose ODM.
post  mongoose  mongodb  referencing  schema  howto 
10 weeks ago by eugenexxv
Building a Node.js Powered API with Express, Mongoose & MongoDB - The Stream Blog
Last year, I created a post on how to build a RESTful API with Restify. Now that Express and Restify are nearly neck and neck in terms of requests per second, I thought it might be interesting to show you how I go about structuring my APIs with Express.
nodejs  mongoose  api 
11 weeks ago by narven
mongoose typescript models · Appsilon/styleguide Wiki
GitHub is where people build software. More than 27 million people use GitHub to discover, fork, and contribute to over 80 million projects.
typescript  mongoose 
12 weeks ago by narven

« earlier    

related tags

advice  api  api_building  arduino  array  async  attributes  authentication  await  bcrypt  c++  cessanta  chat  cobra  coffeescript  crossplatform  crud  cursor  custom  database  db  debugging  dev  discriminator  doc  docker  docs  documentation  elasticsearch  enchanting  encryption  enum  erlang  error-handling  example  express  expressjs  feathers  fieldwork  geocoder  getters  gist  github  graphql  hackster.io  hapi  howto  ifttt  im  index  indexes  india  instance  intermediate  internet  intersection  iot  jabber  javascript  joi  js  json  jungle-book  library  methods  migrations  mocha  modifiers  mogodb  mondogb  mongo  mongoclient  mongodb  mongooseos  multiple  node.js  node  nodejs  nodejsauthenication  nosql  npm  odm  orm  package  pagination  passport  password  php  pocket  post  postgresql  projects  promises  queries  rapid_development  reactjs  reference  referencing  relay  repeating  resources  rest  rudyard-kipling  schema  schemas  scheme  screencasts  security  setters  static  swig  tdd  test  testing  text  todo  tools  tutorial  tutorials  typescript  usecase  username  validation  virtual  vuejs  warcraft  webapplications  webdev  webserver  wireshark  xmpp  year:2014  year:2018  yeoman  yield 

Copy this bookmark:



description:


tags: