Use distinct in php MongoDB query

Use distinct in php MongoDB query

In my cars_positions database and positions collection I have this kind of data :
db.positions.find()
{ “_id” : ObjectId(“536a5cd9e9df25cd8609d286”), “car” : { “type” : “sport”, “ref” : “nameOfTheCar1” }, “position” : { “dateTime” : “2014-05-06T06:42:10”, “latitude” : “0000.1111”, “hemesphere” … Read the rest “Use distinct in php MongoDB query”

How to implement a cron job (using node-schedule) in a Node JS application

How to implement a cron job (using node-schedule) in a Node JS application

It has been a few days I have started learning Node JS.
My Node JS application has a get api which fetches the books information from the MongoDB database in json format … Read the rest “How to implement a cron job (using node-schedule) in a Node JS application”

Android Studio: connecting to MongoDB server with Mongo Java Driver

Android Studio: connecting to MongoDB server with Mongo Java Driver

There’s a lot of posts about this problem, but noone seems to work, so maby some things have changed.
I am trying to connect my android application to a MongoDB server located on mLab. I’m … Read the rest “Android Studio: connecting to MongoDB server with Mongo Java Driver”

Create a mongo connection and make it alive for execution of an Entire Test Suite in Ready!API

Create a mongo connection and make it alive for execution of an Entire Test Suite in Ready!API

If you want to make an gmongo connection alive for an entire test suite and then close it in a tear down operation after the entire test suite … Read the rest “Create a mongo connection and make it alive for execution of an Entire Test Suite in Ready!API”

Authentication Failed Mongoose

Authentication Failed Mongoose

I’m trying to enable auth into my mongo server. I’ve already done:
-Configured security into mongo.conf
-Created the users(if use it with mongo -u -p….. from console works fine)
In the node server js my config is this
mongoose.connect(mongodb://user:pass@localhost:27017/dbName);

Also I’ve already … Read the rest “Authentication Failed Mongoose”

Querying with .toArray won’t return any results to view

Querying with .toArray won’t return any results to view

Trying to return all the ‘titles’ of the news. It is not returning anything to frontend. What’s the problem?
var table = [];

router.get(‘/api/v1/news’, function (req, res) {

var title = req.params.title;

News.find({title: title}).toArray(function (err, news) … Read the rest “Querying with .toArray won’t return any results to view”

Node js & mongoDB – TypeError: db.collection is not a function

Node js & mongoDB – TypeError: db.collection is not a function

I am trying to post data from POSTMAN to an external database that I created on mLab but I am getting the error db.collection is not a function.
There is a similar question thread … Read the rest “Node js & mongoDB – TypeError: db.collection is not a function”

How to compare all documents in two collections with millions of doc and write the diff in a third collection in MongoDB

How to compare all documents in two collections with millions of doc and write the diff in a third collection in MongoDB

I have two collections (coll_1, coll_2) with a million documents each.
These two collections are actually created by running two versions of a … Read the rest “How to compare all documents in two collections with millions of doc and write the diff in a third collection in MongoDB”

How can I handle a very large database and do not miss the performance?

How can I handle a very large database and do not miss the performance?

if i want to develop an application, I’m worried about its performance after the number of users and stored data increases.
actually I don’t know what is the best way to … Read the rest “How can I handle a very large database and do not miss the performance?”