Query all collection names - ravendb

Is there a way to query all the collection names? I figured there must be a relatively straight-forward way since Raven Studio is already doing it?
Thanks.

You can use GetTermsAsync.
Using example:
DatabaseCommands.GetTermsAsync("Raven/DocumentsByEntityName", "Tag", "", 100)

Related

Selecting documents with empty strings in RavenDB Studio

This ought to be simple enough, but I can't get a select statement going in RavenDB Studio where I say "give me all documents where field NAME_x is empty".
The usual suspects don't yield anything:
NAME_5:[[EMPTY_STRING]]
NOT NAME_5:[[EMPTY_STRING]] (just to see if the logic was backwards somehow)
NAME_5: [[NULL_VALUE]]
The index DOES include all fields (NAME_0 through NAME_5) and there ARE plenty of records that have this
(...)
"NAME_5": "",
(...)
so my quesion is - why don't they show up ? I guess the query's syntax is wrong, but I don't know where/how.
Thanks for a hint !
This should just work.
See: http://live-test.ravendb.net/studio/index.html#databases/query/index/recentquery--187795092?&database=44438301
Here is what I get when I try.

nHibernate abstractCriterion and making dynamically query

What i need to do is make query in nHibernate (fully dynamically i don't know how many objects i will have).
What this query should returns are objects of specific Ids(i got List<int>).
Is there any way to make restriction like
Restrictions.Eq("Id",first item from my list of ints).Or("Id",second item) .... and so on.
I know i can make it with AbstractCriterion but have no idea how to check if object from my List<int> is first one.
So how can I make that?
Thanks for advance:)
You need the In criteria:
session.CreateCriteria(typeof(XYZ))
.Add(Expression.In("Id", values))

Propel ORM: How to use own brackets in where clause

i use propel for database interaction. Now i have to create a query like
SELECT data FROM values WHERE a=1 AND (vis=1 or (vis=0 AND userID=5));
I create a propel object from the table "values".
$p = new ValuesQuery()::create
->filterByA(1)
->filterByVis(1)
->_or()
->filterByVis(0)
->filterByUserId(5)
->findOne();
Propel generates the following SQL-Query which mostly makes sense:
SELECT data FROM values WHERE a=1 AND (vis=1 or vis=0) AND userID=5;
How can i fix this? Is it possible to say propel what it should put in brackets?
Thanks for all answers!
As #halfer said, read the following documentation on how to combine several conditions: http://www.propelorm.org/reference/model-criteria.html#combining_several_conditions
Playing with next tool may not only answer your particular question, but also help you understand, how complicated conditions are built.
http://propel.jondh.me.uk/criteria/analyse

Nhibernate : QueryOver equivalent for ICriteria's SetComment?

Is is possible to add a comment to generated by queryover query in Visual Studio's output?
Previously when we were using ICriteria, there was simple SetComment method and we could set the query name so it was much easier to find specific query in output full of long (almost the same) queries. If it is possible we would prefere to add such comments without converting query to ICriteria.
I don't think there is a direct way of doinf it, but you can try with:
QueryOver<Entity>()
.Where(...
.UnderlyingCriteria.SetComment("....")

How to populate a List of strings from a DataTable?

I'm trying to populate a List with a column of a DataTable in order to later convert it to a AutoCompleteStringCollection later. Is there a neater way to do it than the "good old" For Each?
Is there a way to use myDataTable.Rows.CopyTo for this task?
Cheers! = )
See this :- Best practice when converting DataColumn values to an array of strings?
No, I don't believe so. You can do some fancy LINQ expressions, but they all get boiled down to looping through the rows...