New “Select” feature

A new version of djondb is available!

Find with select

With the version 0 potenzmittel 100 pillen cialis tadalafil.120120913 of djondb you will be able to retrieve partial contents of your stored BSONs, this will reduce the bandwidth consumption, memory, etc.

It’s very easy to use, let’s see how it works using a product namespace, here’s a sample of one document stored:

{
    "code": "0001",
    "prod_name": "TV",
    "price": 550,
    "retail": [
        {
            "name": "Photo Plus",
            "address": "Av Rockdrive 1345"
        },
        {
            "name": "TV Club",
            "address": "Av Sunshine 4512"
        }
    ]
}

If you want to retrieve a list of your products, but you dont want to retrieve all the information of the product, then you will use:

find(‘mydb’, ‘products’, ‘$”prod_name”‘, ”);

this will retrieve all your products, including only the product name as part of the result, here’s the result of the above instruction:

[
    { "prod_name": "TV" },
    { "prod_name": "Camera" },
    { "prod_name": "DVD" }
]

What if you want to retrieve the product names and the name of the retailer?, then you will use:

find(‘mydb’, ‘products’, ‘$”prod_name”, $”retail.name”‘, ”);

this will get the following result:

[
    {
        "prod_name": "TV",
        "retail": [
            { "name": "Photo Plus" },
            { "name": "TV Club" }
        ]
    },
    {
        "prod_name": "Camera",
        "retail": [
            { "name": "Photo Plus" },
        ]
    },
    {
        "prod_name": "DVD",
        "retail": [
            { "name": "TV Club" }
        ]
    }
]

it couldn’t be easier, What do you think?

Posted in djondb Features.
Loading Facebook Comments ...

Leave a Reply

Your email address will not be published. Required fields are marked *