jongo | Query in Java as in Mongo shell

 by   bguerout Java Version: 1.4.0 License: Apache-2.0

kandi X-RAY | jongo Summary

kandi X-RAY | jongo Summary

jongo is a Java library typically used in MongoDB applications. jongo has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can download it from GitHub, Maven.

Faithful spirit, Mongo query language isn't available in Java, Jongo fixes that. Copy/paste your queries to string. Object oriented, Save & find objects into & from collections. Use embedded Jackson marshalling or your own. Wood solid, As fast as Mongo Java driver. Open source, fully tested & made of rock solid libraries. Documentation available at

            kandi-support Support

              jongo has a highly active ecosystem.
              It has 573 star(s) with 147 fork(s). There are 45 watchers for this library.
              It had no major release in the last 12 months.
              There are 3 open issues and 275 have been closed. On average issues are closed in 2160 days. There are 4 open pull requests and 0 closed requests.
              It has a positive sentiment in the developer community.
              The latest version of jongo is 1.4.0

            kandi-Quality Quality

              jongo has 0 bugs and 0 code smells.

            kandi-Security Security

              jongo has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              jongo code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              jongo is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              jongo releases are available to install and integrate.
              Deployable package is available in Maven.
              Build file is available. You can build the component from source.
              It has 8033 lines of code, 941 functions and 147 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed jongo and discovered the below as its top functions. This is intended to give you an instant insight into jongo implemented functionality, and help decide if they suit your requirements.
            • Creates a query object for the given query
            • Adds the required quotes and parameters to the query string
            • Returns true if the token represents a value token
            • Replace parameters
            • Get the embedded object
            • Creates ObjectId from legacy format
            • Write minKey
            • Creates the default mapping
            • Modifies the annotation mapper
            • Modifies this objectMapper by setting the visibility of the given objectMapper
            • Gets a parser
            • Write a native object id
            • Converts this query into a list of distinct values
            • Write the MaxKey
            • Gets a collection
            • Determines if a token is quoted
            • Write decimal
            • Write a BSON timestamp
            • Returns the id of the given pojo
            • Gets the id of a pojo
            • Write a binary
            • Returns a BSONGenerator for the output
            • Sets the objectid on the given target object
            • Deserialize the MONGO_OID
            Get all kandi verified functions for this library.

            jongo Key Features

            No Key Features are available at this moment for jongo.

            jongo Examples and Code Snippets

            No Code Snippets are available at this moment for jongo.

            Community Discussions


            Connection pool in MongoDB with jongo
            Asked 2019-Jul-05 at 13:56

            I would like to use connection pool for MongoDB. I have used MongoDB with Jongo and Spring MVC framework.

            Here is my spring xml code for MongoDB configuration, which is working fine.



            Answered 2019-Jul-05 at 13:56


            Compare two files contents and create a new output file, preserving some structure
            Asked 2019-Apr-24 at 20:52

            I have two large text files containing a list of dependencies.

            The first file contains a list of dependencies in a project sorted by service a small snippet of the file looks like this:




            Answered 2019-Apr-23 at 23:35

            Your sample output contains services that aren't in your sample input, which makes testing hard, but maybe:



            Collation with jongo
            Asked 2018-Apr-03 at 09:46

            I use MongoDB via Jongo (a Java client), and I need to sort results in a case-insensitive way for a particular query.

            MongoDB's documentation states that an index should be created with a certain collation level, and that the queries should use the same configuration :



            Answered 2018-Apr-03 at 09:46

            Use a query modifier which can be set on DBCursor by implementing QueryModifier and pass it in the 'with' method:



            Custom aggregation with WSO2EI and MongoDB
            Asked 2018-Feb-26 at 14:29

            I'm tring to implement aggregation operations for Mongo data service in WSO2DSS (in WSO2EI) since only the basic operations like CRUD and Count are supported out of the box as mentioned here. So I cloned WSO2EI code version 4.4.10 (our team happens to be using this version) and I've successfully added some of my own functionality. However, whenever I try to use org.jongo.MongoCollection.aggregate() function, I get error Error in MongoQuery.runQuery: Command failed with error 9: 'The 'cursor' option is required, except for aggregate with the explain argument'. I checked all the posts regarding this issue and tried to use different versions of Mongo driver (3.4, 3.6..), also changed the actual syntax a lot but no matter what I try, I always get this error if I use the .aggregate() function. Also should I be using org.jongo.MongoCollection.aggregate(String pipelineOperator) or com.mongodb.async.client.aggregate(java.util.List pipeline) as stated in the Mongo Java 3.6 documentation here. Example code I used:



            Answered 2018-Feb-26 at 14:29

            From the docs.

            MongoDB 3.4 deprecates the use of aggregate command without the cursor option, unless the pipeline includes the explain option. When returning aggregation results inline using the aggregate command, specify the cursor option using the default batch size cursor: {} or specify the batch size in the cursor option cursor: { batchSize: }.

            You can pass batchSize with AggregationOptions for Jongo Aggregate method.



            Mapping JSON to Class not working
            Asked 2017-Oct-06 at 07:26

            I have a class which contains other some properties of another classes and when I try to convert from json to my class, there is an error displayed.

            This is my class:



            Answered 2017-Oct-06 at 07:26

            I finnally found the solution;

            There is needed an empty constructor in all classes FlightDTO, HotelDTO, CarDTO plus I should rewrite the toJson method as following:



            Query Date in Jongo
            Asked 2017-Jun-23 at 08:59

            I want to use Jongo for date queries. The user should be able to enter a string with the query, so I want to use the find method with a string. I am using groovy.

            My code:



            Answered 2017-Jun-23 at 08:59

            Yep found the relevant line in the source code to confirm

            "ISODate" has nothing to do with this, it's a JavaScript function name in the mongo shell.

            Jongo is using the MongoDB Extended JSON standard for parsing. So you would do



            MongoDB java driver using regex query to retrieve first two character
            Asked 2017-May-05 at 17:05

            i want to retrieve first two character value like if i give 02-01-2017 00:05:46 i should get result like



            Answered 2017-May-05 at 17:05

            As stated by Wiktor Stribiżew

            p.getData() returns a String that is added to the listModel. Use p.getData().replaceFirst("^(\S+\s\S+).*", "$1")



            Play with subprojects routes
            Asked 2017-Apr-20 at 14:07

            I have a Play! 2.5.3 project with one subproject (with its own routes). In the main routes file the subproject's routes are defined as follows:



            Answered 2017-Feb-22 at 23:14

            I don't think you could do that, the projects are binary bound, I mean all the module jars has to be there in the class path (as per the build.sbt). You can not run them individually.

            I hope what you are looking is a microservices kind of stuff. If so, you need to be aware of the costs that come with microservices. Once you decide to go with microservices, you can take a look at Lagom Framework (



            Comparing save methods through load test between Jongo driver, Java MongoDB driver and MongoRepository
            Asked 2017-Apr-11 at 14:36

            In my diploma thesis I developed REST API for select/save operations between client and database. Data will be post from sensors as JSON and stored in MongoDB . We chose three different technologies for storing: Jongo driver 1.3.0, Java MongoDB driver 3.4.0 and MongoRepository from Spring (with Jackson FasterXML). After implemenetation we started with load tests through JMeter. Test case had these parameters:

            threads - 100, 250, 500, 1000

            ramp up period - 10 seconds

            loop count - 30

            We are supposed that drivers will be more effective than MongoRepository, but in case of 1000 threads MongoRepository load 400 requests per second and drivers could not process all of requests. So MongoRepository can store rapidly fast. Can anyone says why MongoRepository is more effective ?


            MongoRepository look like this:



            Answered 2017-Apr-10 at 22:31

            Jongo is not a driver, it uses one. Basically, the one you mentioned next - that is the "official" driver. And the third is even the interface, that has two different implementations - which one's yours?

            So, see, there's kind of conceptual mess you've just created. And to answer your question, you need to get into implementation details for each case.

            I can just presume that, being enterprise-grade and quite mature framework, Spring has more effecient concurrent implementation, something with connection/worker pools or stuff like that.



            get jackson to ignore a field in a map
            Asked 2017-Mar-31 at 14:16

            I am combining Spring Boot and jongo/mongo to create a dynamic mongo app that does not use POJO's. Everything in and out of the database is a Map. I have everything working exactly the way I want, except one thing. I don't want to send _id from mongo to the client. This system uses a "mark obsolete and insert new record" style of updates so we can maintain a change history for the document. therefore, I don't want any client to even be tempted to use the _id field, I have another I want them to use.

            Now I find all kinds of examples on how to ignore fields in pojo's, but i want to write a Jackson Map serializer that ignores a specific value of the map. I can't find anything like that yet. I suppose gson would do as well, I just don't currently have spring configured for gson.

            any idea how to write this serializer?



            Answered 2017-Mar-31 at 14:11

            I would not try to make Jackson make the work mongo can simply do.

            The mongo documentation explicitly has a use case that is named Return All But the Excluded Fields which is exactly what you want:


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install jongo

            You can download it from GitHub, Maven.
            You can use jongo like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the jongo component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer For Gradle installation, please refer .


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone bguerout/jongo

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Java Libraries


            by CyC2018


            by Snailclimb


            by MisterBooo


            by spring-projects

            Try Top Libraries by bguerout


            by bgueroutJava


            by bgueroutJavaScript


            by bgueroutJava


            by bgueroutJavaScript


            by bgueroutShell