Discussion:
[mongodb-dev] how to convert mysql queries to mongodb?
arpit bhatt
2018-01-24 07:44:23 UTC
Permalink
how can i get the result of this mysql query with mongodb?

SELECT * FROM mars_india.user where DATE(creation_date) between
'2015-11-03' and '2015-11-04';
--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-dev/149e399a-5206-4541-bd5c-fffd0485be50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ivan Artemov
2018-01-24 12:49:46 UTC
Permalink
http://www.querymongo.com/
Post by arpit bhatt
how can i get the result of this mysql query with mongodb?
SELECT * FROM mars_india.user where DATE(creation_date) between
'2015-11-03' and '2015-11-04';
--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-dev/82153faf-41cf-43c8-a531-b7e5c0a01998%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
gaurav.gupta via mongodb-dev
2018-01-31 07:24:09 UTC
Permalink
Hi Arpit,

Please note that the mongodb-dev
<https://groups.google.com/forum/#!forum/mongodb-dev> mailing list is for
MongoDB development topics only. If you need to ask general questions,
please go to the mongodb-user
<https://groups.google.com/forum/#!forum/mongodb-user> google group.

For querying results within a range of date/value from mongodb collection,
you need to use db.collection.find()
<https://docs.mongodb.com/manual/reference/method/db.collection.find/>
method with query criterias
<https://docs.mongodb.com/manual/reference/method/db.collection.find/#examples>
.
I have formulated this query, assuming ‘creation_date’ is of datatye *date*
<https://docs.mongodb.com/manual/reference/bson-types/#date>, to match your
given MySQL example :

db.user.find({ creation_date :{ $gt : new ISODate("2018-01-31"), $lt : new ISODate("2018-02-24")}}).pretty()

You should also refer to Mongo Shell Methods
<https://docs.mongodb.com/manual/reference/method/#collection> for more
in-depth information on other MongoDB query language operators.

As for http://www.querymongo.com/, it may contain deprecated/removed
MongoDB method as its not up-to-date.
Please refer to db.collection.find()
<https://docs.mongodb.com/manual/reference/method/db.collection.find/#db.collection.find>
and db.collection.aggregate()
<https://docs.mongodb.com/manual/reference/method/db.collection.aggregate/>
or a more up-to-date query or aggregation methods.

Regards,
Gaurav
​
--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-dev/d246ad21-c6ff-49da-8e86-1dfafb126e73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Bryan Reinero' via mongodb-dev
2018-01-31 15:01:04 UTC
Permalink
Arpit,

You should check out the MongoDB BI Connector, which sits between your SQL
client and your MongoDB deployment, translating incoming MySQL queries into
aggregation pipelines and returning the results back as a relation. Here's
a link https://www.mongodb.com/products/bi-connector
Post by arpit bhatt
how can i get the result of this mysql query with mongodb?
SELECT * FROM mars_india.user where DATE(creation_date) between
'2015-11-03' and '2015-11-04';
--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-dev/d76d1d98-e1cd-41e4-8b10-99a5e8aba9cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
David Murphy
2018-01-31 15:24:15 UTC
Permalink
Additionally you might look at slam data as it does this to allow Tableau and MongoDB to talk and its open source compared to BI connector being Enterprise only.
Post by gaurav.gupta via mongodb-dev
Arpit,
You should check out the MongoDB BI Connector, which sits between your SQL client and your MongoDB deployment, translating incoming MySQL queries into aggregation pipelines and returning the results back as a relation. Here's a link https://www.mongodb.com/products/bi-connector
how can i get the result of this mysql query with mongodb?
SELECT * FROM mars_india.user where DATE(creation_date) between '2015-11-03' and '2015-11-04';
--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
Visit this group at https://groups.google.com/group/mongodb-dev <https://groups.google.com/group/mongodb-dev>.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-dev/d76d1d98-e1cd-41e4-8b10-99a5e8aba9cd%40googlegroups.com <https://groups.google.com/d/msgid/mongodb-dev/d76d1d98-e1cd-41e4-8b10-99a5e8aba9cd%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout>.
--
You received this message because you are subscribed to the Google Groups "mongodb-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-dev+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-dev.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-dev/0C250F17-5C46-492E-94DE-DE503B1DFD29%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...