Newbie Qs

29 views
Skip to first unread message

frye

unread,
Mar 11, 2011, 2:25:37 PM3/11/11
to FleetDB
Hi there, I'm new to FleetDB, and am wondering whether FleetDB has the
following features

A) Can we add / search within subdirectories? So far, I can only see
that a client can operate on 'parentdir', not 'parentdir/childdir'. So
the example on the site, gives i., but it would also be nice to do
ii.:

i. (client ["insert" "parentdir" {"id" 1, "tag" "parent" }])
ii. (client ["insert" "parentdir/childdir" {"id" 1, "tag" "child" }])


B) Can we search within a document that's more than 1 level deep. So,
for the document below, how can I select a "child" with a value of
"foo" (if possible).

{"id" 1, :tag :parent,
:children { "id" 1.1, "tag" "child", "value" "foo" } }

Or would i just get the document and search a big s-expr?


Thanks in advance
Tim

Mark McGranaghan

unread,
Mar 22, 2011, 4:05:45 AM3/22/11
to fle...@googlegroups.com, frye
On Fri, Mar 11, 2011 at 11:25 AM, frye <twas...@gmail.com> wrote:

Hi Tim,

> Hi there, I'm new to FleetDB, and am wondering whether FleetDB has the
> following features
>
> A) Can we add / search within subdirectories? So far, I can only see
> that a client can operate on 'parentdir', not 'parentdir/childdir'. So
> the example on the site, gives i., but it would also be nice to do
> ii.:
>
> i. (client ["insert" "parentdir" {"id" 1, "tag" "parent" }])
> ii. (client ["insert" "parentdir/childdir" {"id" 1, "tag" "child" }])

Right, FleetDB does not have a notion of subdirectories on
collections. If you have few such subdirectories, I'd suggest making a
collection for each. If you have many, the subdir name should be an
attribute of the record.

>
> B) Can we search within a document that's more than 1 level deep. So,
> for the document below, how can I select a "child" with a value of
> "foo" (if possible).
>
> {"id" 1, :tag :parent,
>            :children { "id" 1.1, "tag" "child", "value" "foo" } }

> Or would i just get the document and search a big s-expr?

Right, you can only search 1 level deep. You can consider flattening
and unflattening the data in your application to achieve a similar
effect.

> Thanks in advance
> Tim

Mark

Reply all
Reply to author
Forward
0 new messages