I'm trying Mongo db and I wonder if it's possible to only get a specific part of a document?
For example I have:
{ "name" : "MongoDB", "info" : { x : 203, y : 102 } }
and I only want the content of info
.
The closest I found is db.collection.find({}, { info: 1 })
but this returns me { "info" : { x : 203, y : 102 } }
when I only need { x : 203, y : 102 }
.
Extract Pages From Word – EasyClick at the beginning of the page, hold the left mouse button down, and drag the cursor to the end of the page to highlight all the content you want. Then press Ctrl+C to copy the text or Ctrl+X to cut it out of the document.
To select lines, click on the left edge of the window, or press CTRL + F8. To select vertically (in a rectangular block), use the mouse to select while pressing the ALT key, or press SHIFT+ CTRL + F8.
You could do
db.collection.find({},{'info.x':1, 'info.y':1})
but that means listing each and every item of the info object in the projection - which may or may not be what you're looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With