MongoDB
May 26, 2024 |
permanent
Database #
Salable nosql, schema less, database.
Interacting with database with CLI, shell, using mongosh #
docker exec -it mongo mongosh
# to see databases
show dbs
# to select one db
use tfarraj-dev
# to see tables
show tabels # or show collection
# to see table columns by priniting one record
db.videos.findOne()
Mongoose: object modeling #
Mongoose is an Object Data Modeling (ODM) library for MongoDB and Node.js. It manages relationships between data, provides schema validation, and is used to translate between objects in code and the representation of those objects in MongoDB.

migrations #
Common #
- Both of these tools use mongodb feature to do the migrations.
- Both stores migration state in the database.
- use table or collection name to implement migrations.
- more popular: 232 commits, 618 stars and 14 contributors, used by 2.3k users
- mongoose models can be used in migrations
- less popular: 98 commits, 220 stars and 10 contributors, used by 1k users
Conclusion: #
why use migrate-mongo?
- popular
- straightforward
- just manages the state of migrations, migrations are done using native mongodb features
why use migrate-mongoose?
- The only advantage of using migrate-mongoose over migrate-mongo is the features that allows using mongoose model at the expense of adding it own abstraction layer.
- The migrations can also be implemented without using mongoose model, similar to migrate-mongo.
- My personal preference is migrate-mongo, unless it makes it easier to deal with migrations using models.
migration examples #
migrations samples migrate-mongo:
rename:
module.exports = async up(db, client) await db.collection('videos').updateMany( , $rename: content: 'game' , ); , async down(db, client) await db.collection('videos').updateMany( , $rename: game: 'content' , ); , ;
add property:
module.exports = await db.collection('videos').updateMany(, $set: tags: [] ); , async down(db, client) await db.collection('videos').updateMany(, $unset: tags: null ); , ;
migrate-mongoose
async function up() await this('user').create( firstName: 'Ada', lastName: 'Lovelace' );notice the difference here “this“ instead of “db.collection” to access tables or collections.
using model and mongoose ODM
import User from '../models' async function up() await User.create( firstName: 'Ada', lastName: 'Lovelace' ); // OR do something such as const users = await User.find(); /* Do something with users */
OCI #
It is possible to use Oracle JSON Database to replace mongodb Oracle Database API for MongoDB


DO #
- The Fully Managed services here is of MongodDB not MongoDB Atlas release of mongodb in 2021 as DO managed service
OCR of Images #
2022-01-15_01-07-38_screenshot.png #

node mongoose elegant a object nodeg for nodep S OBJECT MAPPING MONGO DRIVER mongoDB. Object Mapping between Node and MongoDB managed via Mongoose
2024-04-02_17-15-36_screenshot.png #

Compartment rogerford2 (root) Display name Example Database Database name ExampleDB A user-triendly name to help you easily identify the resource. The name must contain only letters and numbers, starting with a letter. Maximum of 14 characters. Choose a workload type Data Warehouse Built for decision support and data warehouse work- loads. Fast queries over large volumes of data. Transaction Processing Built for transactional workloads. High con- currency for short- running queries and transactions. JSON Built for JSON- centric application development. Developer-triendly document APIS and native JSON storage. APEX Built for Oracle APEX application develop- ment. Creation and deployment of low- code applications, with database in- cluded. Choose a deployment type Shared Infrastructure frastructure. Dedicated Infrastructure Run Autonomous Database on dedicated Exadata Run Autonomous Database on shared Exadata in- infrastructure. Scroll down to "Create administrator credentials", - and enter and confirm a password for the ADMIN user. Don't forget th password! Create administrator credentials @ Username Read-Only ADMIN ADMIN username cannot be edited. Password Confirm password
2024-04-02_17-15-46_screenshot.png #

SCHEDULING Ani interface for ORACLE MACHINE LEARNING Oraclel Machine Learning provides DBVS_SCHEDULER that enable.. sevoral components accessible.. & APEX GRAPH STUDIO Graph Studio automates the creation of knowledge (RDF) an Login to APEX, develop and run rich, low-code web applications. Administration & DATABASE USERS REST enable schemas, change Downloads X APEX WORKSPACES Create and delete APEX DOWNLOAD ORACLE INSTANT CLIENT This isi at free, light-weight set of tools, libraries and SDKS for.. 0 DOWNLOAD SODA DRIVERS Simple Oracle Document Access (SODA) is a set of APIS for using- passwords, assign storage quot. workspaces, view the st of... TI DATA PUMP DOWNLOAD CLIENT CREDENTIALS (WALLET) DOWNLOAD MICROSOFT EXCEL/GOOGLE SHEETS ADD-IN These add- -in's enable: you to retrieve and analyze data from... View Data Pump jobs and use our Connections to Autonomous wizard to quickly create and run Database use a secure.- SET RESOURCEI MANAGEMENT RULES Set resource management rules to allocate CPUNO shares to. Related Services Monitoring - RESTFUL SERVICES. AND SODA Oracie REST Data Services (ORDS) provides HTTPS.- ORACLE MACHINE LEARNING RESTFUL SERVICES Oraciel Machine Leaming provides REST APIS for OML4Py.- PERFORMANCE HUB Access SQL Monitoring reports - DATABASE DASHBOARD Monitor database activity charts and Active: Session History (ASH.. such as CPU usage, number of.. ORACLE DATABASE API FOR MONGODB Oracle Database API for MongoDB enables MongoDB-