CAST supports MongoDB as follows:
- via its Node.js extension when the source code language is JavaScript
- via its Typescript and Frameworks extension when the source code language is TypeScript.
Details about how this support is provided is discussed below.
Objects
The following specific objects are displayed in CAST Enlighten:
Node.js MongoDB connection | |
Node.js MongoDB collection |
Code sample
This declaration will create a MongoDB connection and model object
Connector "Mongoose"
var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost/analyzerlauncher', function(err) { if (err) { throw err; } }); // create a Mongoose model userModel = mongoose.model('users', userSchema);
What results can you expect?
Once the analysis/snapshot generation has completed, you can view the results in the normal manner (for example via CAST Enlighten):
Node.js application with MongoDB data storage exposing web services.