Maruthi Krishna has Published 870 Articles

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

Maruthi Krishna

Maruthi Krishna

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

20K+ 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

2K+ 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

253 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

583 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

538 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

227 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

How to draw a filled circle in OpenCV using Java?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 07:48:35

668 Views

The org.opencv.imgproc package of Java OpenCV library contains a class named Imgproc. This class provides a method named circle(), using this you can draw a circle on an image. This method provides the following parameters −A Mat object representing the image on which the circle is to be drawn.A Point ... Read More

How to convert OpenCV Mat object to JavaFX WritableImage?

Maruthi Krishna

Maruthi Krishna

Updated on 10-Apr-2020 07:46:37

380 Views

If you try to read an image using the OpenCV imread() method it returns a Mat object. If you want to display the contents of the resultant Mat object using a JavaFX window You need to convert the Mat object to an object of the class javafx.scene.image.WritableImage. To do so, ... Read More

Advertisements