# Query MongoDB msg.projection

**URL:** <https://discourse.nodered.org/t/query-mongodb-msg-projection/19476>\
**Category:** General\
**Created:** [22 December 2019 17:52 UTC](https://discourse.nodered.org/t/query-mongodb-msg-projection/19476 "2019-12-22T17:52:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mfelix](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@mfelix](https://discourse.nodered.org/u/mfelix)\
**Post date:** [22 December 2019 17:52 UTC](https://discourse.nodered.org/t/query-mongodb-msg-projection/19476/1 "2019-12-22T17:52:09Z")

</div>

Hello,

I want to query a Mongo DB.  
Before the "MongoDB in"-node I have a "function"-node.  
There I define an msg.projection object like this:

```auto
msg.projection =
{
temperature: 21
}
return msg;

```

However, this is not working.  
Do you have an example to define projections for mongo db queries?

Regards  
Martin

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [22 December 2019 18:09 UTC](https://discourse.nodered.org/t/query-mongodb-msg-projection/19476/2 "2019-12-22T18:09:24Z")

</div>

Welcome to the forum.  
Which MongoDB node are you using?

---

<div class="post-metadata">

**Author:** ![mfelix](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@mfelix](https://discourse.nodered.org/u/mfelix)\
**Post date:** [22 December 2019 18:38 UTC](https://discourse.nodered.org/t/query-mongodb-msg-projection/19476/3 "2019-12-22T18:38:45Z")

</div>

I am using the "mongodb in node" with the find method.  
I want to make a concrete query and specify it.

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [22 December 2019 18:53 UTC](https://discourse.nodered.org/t/query-mongodb-msg-projection/19476/4 "2019-12-22T18:53:05Z")

</div>

There are a couple of MongoDB nodes, you have to tell us which one you installed. have a look in the "Manage palette" menu for installed nodes.

---

<div class="post-metadata">

**Author:** ![mfelix](https://avatars.discourse-cdn.com/v4/letter/m/b4bc9f/32.png) [@mfelix](https://discourse.nodered.org/u/mfelix)\
**Post date:** [22 December 2019 18:58 UTC](https://discourse.nodered.org/t/query-mongodb-msg-projection/19476/5 "2019-12-22T18:58:15Z")

</div>

I am using node-red-node-mongodb 0.0.14.  
Thanks for your help.

Martin

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [22 December 2019 19:07 UTC](https://discourse.nodered.org/t/query-mongodb-msg-projection/19476/6 "2019-12-22T19:07:27Z")

</div>

> [@mfelix](#):
>
> I am using node-red-node-mongodb 0.0.14.

Good, that node is maintained by @knolleary and @dceejay. I have no knowledge of MongoDB but I'm sure you will get some help soon.
