Page tree
Skip to end of metadata
Go to start of metadata

CAST supports MongoDB via its NoSQL for Java extension. Details about how this support is provided for Java source code is discussed below.

Supported Libraries

Supported Operations

For Storing the data
 Insert Operation APIs
  • com.mongodb.DBCollection.insert
  • com.mongodb.client.MongoCollection.insertOne
  • com.mongodb.client.MongoCollection.insertMany
  • com.mongodb.client.MongoCollection.bulkWrite
  • com.mongodb.DBCollection.save
  • org.jongo.MongoCollection.insert
  • org.jongo.MongoCollection.save
For Fetching the data
 Select Operation APIs
  • com.mongodb.client.MongoDatabase.getCollection
  • com.mongodb.client.MongoCollection.countDocuments
  • com.mongodb.client.MongoCollection.count
  • com.mongodb.client.MongoCollection.find
  • com.mongodb.client.MongoCollection.findOneAndDelete
  • com.mongodb.client.MongoCollection.findOneAndReplace
  • com.mongodb.client.MongoCollection.findOneAndUpdate
  • com.mongodb.DB.getCollection
  • com.mongodb.DBCollection.aggregate
  • com.mongodb.DBCollection.count
  • com.mongodb.DBCollection.distinct
  • com.mongodb.DBCollection.find
  • com.mongodb.DBCollection.findOne
  • com.mongodb.DBCollection.getCollection
  • com.mongodb.DBCollection.getCount
  • com.mongodb.DBCollection.getName
  • com.mongodb.DBCollection.group
  • com.mongodb.DBCollection.findAndModify
  • com.mongodb.DBCollection.findAndRemove
  • org.jongo.Jongo.getCollection
  • org.jongo.MongoCollection.aggregate
  • org.jongo.MongoCollection.count
  • org.jongo.MongoCollection.distinct
  • org.jongo.MongoCollection.find
  • org.jongo.MongoCollection.findAndModify
  • org.jongo.MongoCollection.findOne
  • org.jongo.MongoCollection.getDBCollection
  • org.jongo.MongoCollection.getName
For Removing the data
 Delete Operation APIs
  • com.mongodb.client.MongoCollection.drop
  • com.mongodb.client.MongoCollection.deleteOne
  • com.mongodb.client.MongoCollection.deleteMany
  • com.mongodb.client.MongoCollection.findOneAndDelete
  • com.mongodb.DBCollection.drop
  • com.mongodb.DBCollection.dropIndex
  • com.mongodb.DBCollection.findAndRemove
  • org.jongo.MongoCollection.drop
  • org.jongo.MongoCollection.dropIndex
  • org.jongo.MongoCollection.dropIndexes
  • org.jongo.MongoCollection.remove
For Updating the data
 Update Operation APIs
  • com.mongodb.client.MongoCollection.updateOne
  • com.mongodb.client.MongoCollection.updateMany
  • com.mongodb.client.MongoCollection.findOneAndReplace
  • com.mongodb.client.MongoCollection.findOneAndUpdate
  • org.jongo.MongoCollection.update
  • com.mongodb.DBCollection.update
  • com.mongodb.DBCollection.updateMulti
  • com.mongodb.DBCollection.findAndModify
  • com.mongodb.client.MongoCollection.replaceOne

Objects

IconDescription

Java MongoDB database

Java MongoDB collection

Java unknown MongoDB database

Java unknown MongoDB collection
Link typeSource and destination of linkMethods supported
belongsTo

From Java MongoDB collection object to Java MongoDB database object


useLinkBetween the caller Java Method objects (constructors also) and Java Mongo Collection Object
  • mapReduce
  • createCollection

useSelectLink

 Click here to expand...
  • getCollection
  • countDocuments
  • find 
  • count
  • findOneAndDelete
  • findOneandReplace
  • findOneAndUpdate
  • aggregate
  • distinct
  • findOne
  • getCount
  • getName
  • group
  • findAndModify
  • findAndRemove
useUpdateLink
 Click here to expand...
  • update
  • updateOne
  • updateMany
  • findOneAndUpdate
  • fineOneAndReplace
  • findAndModify
  • rename
  • replaceOne
useDeleteLink
 Click here to expand...
  • findOneAndDelete
  • drop
  • deleteOne
  • deleteMany
  • dropIndex
  • dropIndexes
  • remove
  • findAndRemove
useInsertLink
 Click here to expand...
  • insert
  • insertOne
  • insertMany
  • bulkWrite
  • save

*Bulkops results in the links as per the operations used

What results can you expect

Once the analysis/snapshot generation is complete, you can view the results in the normal manner (for example via CAST Enlighten). Some examples are shown below.

Creation of Database and Collection 

 Click here to expand...
public MongoUserDAO(DB db) {
		Mongo mongo = new Mongo();
		db = mongo.getDB("TestDatabase");
		db.createCollection("User", dbo);
}

Insert Operation

 Click here to expand...
public void insertDocuments(DBObject[] documents) {
		userCol.insert(documents);	
	}

Select Operation

 Click here to expand...
public void getCollection() {
		DBCollection col =  db.getCollection("User");
	}

Update Operation

 Click here to expand...
public void updateDoc(DBObject query, DBObject update) {
		userCol.update(query, update);
	}

Delete Operation

 Click here to expand...


 Evolution

  • There will be no connection object created.
  • Better resolution for database and collection name
  • Support for CRUD APIs com.mongodb.client.MongoCollection

Limitations

  • For the method 'mapReduce' the type of link produced is 'useLink' as its type is not determined
  • If collection name is not resolved in the CRUD API, then link is created with unknown collection object.


  • No labels