Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Filter the fields to return with find()
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Robert Citek  
View profile  
 More options Nov 13 2012, 1:17 am
From: Robert Citek <robert.ci...@gmail.com>
Date: Tue, 13 Nov 2012 01:08:52 -0500
Local: Tues, Nov 13 2012 1:08 am
Subject: Re: [mongodb-user] Filter the fields to return with find()

On Tue, Nov 13, 2012 at 12:49 AM, EricBKK <eric.fai...@gmail.com> wrote:
> You can see we have several fields name starting by "_".
> We would like to execute a find that will return all fields of a record
> without all fields starting by "_"

Assuming the collection is named foo, is this what you are looking for?

> db.foo.find({},{_id:0, "HTTrack._EE":0, "Related to._id": 0, _Source:0}).pretty();

{
        "HTTrack" : {
                "URL" : "http://myURL.html",
                "Date" : "Mon, 25 Jun 2012 22:31:37 GMT",
                "Archive" : "/home/frontware/websites/mypage.html"
        },
        "Imported" : {
                "On" : ISODate("2012-06-26T07:55:40.820Z")
        },
        "Related to" : [
                {
                        "Created on" : ISODate("2012-06-26T09:11:06.614Z"),
                        "Created by" : "Phone Consolidation"
                },
                {
                        "Created on" : ISODate("2012-06-26T13:39:48.906Z"),
                        "Created by" : "Name Consolidation"
                },
                {
                        "Created on" : ISODate("2012-06-26T13:39:48.969Z"),
                        "Created by" : "Name Consolidation"
                }
        ],
        "Tel" : [
                {
                        "Type" : "Fax",
                        "Number" : "+3355555555"
                }
        ]

}

Regards,
- Robert

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.