# Mongo db in node red

**URL:** https://discourse.nodered.org/t/mongo-db-in-node-red/47216
**Category:** General
**Created:** [16 June 2021 04:47 UTC](https://discourse.nodered.org/t/mongo-db-in-node-red/47216 "2021-06-16T04:47:57Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![OmkarNodered](https://avatars.discourse-cdn.com/v4/letter/o/90ced4/32.png) [@OmkarNodered](https://discourse.nodered.org/u/OmkarNodered)
#### Post date: [16 June 2021 04:47 UTC](https://discourse.nodered.org/t/mongo-db-in-node-red/47216/1 "2021-06-16T04:47:57Z")

</div>

I have installed mongo db connector in node red. My mongo db collection has date values in timestamp format. I just want to write a query using mongo db connector so that I should get only last 8 hours date values. How can I write a query in node red?

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [16 June 2021 09:52 UTC](https://discourse.nodered.org/t/mongo-db-in-node-red/47216/2 "2021-06-16T09:52:13Z")

</div>

First off you should ttell us what node you are using -i.e. node-red-contrib-????. Secondly it will be the same query you would use if you were using some other tool. Node-RED is just going to pass the query to the database program so the database program controls the syntax or the query.

Not sure about the mongo db nodes, but other db nodes require the query be in msg.topic

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [15 August 2021 09:53 UTC](https://discourse.nodered.org/t/mongo-db-in-node-red/47216/3 "2021-08-15T09:53:06Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
