Maruthi Krishna has Published 951 Articles

How to drop a MongoDB Collection using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 08:39:17

2K+ Views

You can drop an existing collection from MongoDB using the drop() method.Syntaxdb.coll.drop()Where, db is the database.coll is the collection (name) in which you want to insert the documentExampleAssume we have created 3 collections in a MongoDB database as shown below −> use sampleDatabase switched to db sampleDatabase > db.createCollection("students") { ... Read More

How to delete a MongoDB document using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 08:24:56

3K+ Views

You can delete a document from an existing collection in MongoDB using the remove() method.Syntaxdb.coll.remove(DELLETION_CRITTERIA)Where, db is the database.coll is the collection (name) in which you want to insert the documentExampleAssume we have a collection named students in the MongoDB database with the following documents −{name:"Ram", age:26, city:"Mumbai"} {name:"Roja", age:28, ... Read More

How to retrieve all the documents from a MongoDB collection using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 08:20:50

19K+ Views

You can retrieve documents from an existing collection in MongoDB using the find() method.Syntaxdb.coll.find()Where, db is the database.coll is the collection (name) in which you want to insert the documentExampleAssume we have a collection named students in the MongoDB database with the following documents −{name:"Ram", age:26, city:"Mumbai"} {name:"Roja", age:28, city:"Hyderabad"} ... Read More

How to insert multiple document into a MongoDB collection using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 08:18:40

1K+ Views

You can insert multiple documents into an existing collection in MongoDB using the insertMany() method.Syntaxdb.coll.insert(docArray)Where, db is the database.coll is the collection (name) in which you want to insert the documentdocArray is the array of documents you want to insert.Example> use myDatabase() switched to db myDatabase() > db.createCollection(sample) { "ok" ... Read More

How to insert a document into a MongoDB collection using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 08:15:34

6K+ Views

You can insert a document into an existing collection in MongoDB using the insert() method.Syntaxdb.coll.insert(doc)Where, db is the database.coll is the collection (name) in which you want to insert the documentdoc is the document you want to insert.Example> use myDatabase() switched to db myDatabase() > db.createCollection(sample) { "ok" : 1 ... Read More

How to create a MongoDB collection using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 08:12:03

3K+ Views

You can create a collection in MongoDB using the db.createCollection() method.Syntaxdb.createCollection(name, options)Wheredb is the database.name is the name of the collection you want to create.Option is the set of optional parameters such as capped, auto indexed, size and, max.Example> use myDatabase switched to db myDatabase > db.createCollection("myCollection") { "ok" : ... Read More

How to draw a filled ellipse in OpenCV using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 08:01:15

179 Views

The org.opencv.imgproc package of Java OpenCV library contains a class named Imgproc this class provides various methods to process an input image. It provides a set of methods to draw geometrical shapes on images.This class provides a method named ellipse() using this you can draw an ellipse on an image, ... Read More

How to draw polylines in OpenCV using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 07:58:14

429 Views

The org.opencv.imgproc package of Java OpenCV library contains a class named Imgproc this class provides various methods to process an input image such as resize(), filter2D, etc.. In addition to these It also provides a set of method to draw geometrical shapes on images.Among them to draw a polylines you ... Read More

How to draw a polygon in OpenCV using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 07:55:56

333 Views

A polygon with all the interior angles less than 180 is known as a convex polygon. The org.opencv.imgproc package of Java OpenCV library contains a class named Imgproc. To draw a polygon you need to invoke the fillConvexPoly() method of this class. This method accepts 3 parameters −A Mat object representing ... Read More

How to draw an arrowed line in OpenCV using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 07:53:59

136 Views

The org.opencv.imgproc package of Java OpenCV library contains a class named Imgproc this class provides various methods to process an input image. It provides a set of methods to draw geometrical shapes on images.To draw an arrowed line you need to invoke the arrowedLine() method of this class. This method ... Read More

Advertisements