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
how to retrieve id's of documents along with the documents themselves in RavenBD
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 1 - 25 of 53 - Collapse all  -  Translate all to Translated (View all originals)   Newer >
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
 
Nicolas Spontz  
View profile  
 More options May 2 2012, 1:31 pm
From: Nicolas Spontz <nicolas.roll...@gmail.com>
Date: Wed, 2 May 2012 10:31:10 -0700 (PDT)
Local: Wed, May 2 2012 1:31 pm
Subject: how to retrieve id's of documents along with the documents themselves in RavenBD

Is it possible, when doing a query for a certain kind of documents, to
retrieve also the Ids as well as the documents themselves ?

I did not see how to do so in the documentation.
I do a plain vanilla query for now:

         use session = store.OpenSession()
         let q = session.Query<MyType>()


 
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.
Daniel Lang  
View profile  
 More options May 2 2012, 1:36 pm
From: Daniel Lang <d.l...@flexbit.at>
Date: Wed, 2 May 2012 10:36:19 -0700 (PDT)
Local: Wed, May 2 2012 1:36 pm
Subject: Re: how to retrieve id's of documents along with the documents themselves in RavenBD

You should have an Id property on MyType, don't you?


 
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.
Bryan Johns  
View profile  
 More options May 2 2012, 1:40 pm
From: Bryan Johns <bjo...@greendragonweb.com>
Date: Wed, 2 May 2012 12:40:22 -0500
Local: Wed, May 2 2012 1:40 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD
Here's an example (VB):

Public Class Person
    Public Property Id as Integer
    Public Property Name As String
End Class

Using db as DocumentSession = store.OpenSession
    dim p as New Person With {.Name = "Bobby"}
    db.Store(p)
    db.SaveChanges()
    'at this point p.Id will be the integer value generated by RavenDB
End Using

Using db as DocumentSession = store.OpenSession
    ' query for entities of  type Person with Name = "Bobby"
    dim p As Person = db.Query(Of Person).SingleOrDefault(Function(x)
x.Name = "Bobby")
    ' again, p.Id will be the value generated by RavenDB when the
document was saved.
End Using

--
Bryan Johns
K4GDW
http://www.greendragonweb.com

Do not meddle in the affairs of dragons, for you are crunchy and taste
good with ketchup.

On Wed, May 2, 2012 at 12:31 PM, Nicolas Spontz


 
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.
Chris Marisic  
View profile  
 More options May 2 2012, 1:42 pm
From: Chris Marisic <ch...@marisic.com>
Date: Wed, 2 May 2012 10:42:55 -0700 (PDT)
Local: Wed, May 2 2012 1:42 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

It's always better to use string Id with RavenDB.


 
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.
Nicolas Spontz  
View profile  
 More options May 2 2012, 1:59 pm
From: Nicolas Spontz <nicolas.roll...@gmail.com>
Date: Wed, 2 May 2012 10:59:36 -0700 (PDT)
Local: Wed, May 2 2012 1:59 pm
Subject: Re: how to retrieve id's of documents along with the documents themselves in RavenBD

Actually, I do not have id inside the document. it is all in the "ravendb
id" system from which I can Load any document

So I can perfectly retrieve one particular document using the id, and never
added any field that relates to the storage : why pollute my model when
ravendb handles it fine ?
Now I wanted to mass query them and store them in memory instead of picking
them up one by one, hence the need to have access to the id to set up the
memory association.


 
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.
Daniel Lang  
View profile  
 More options May 2 2012, 2:02 pm
From: Daniel Lang <d.l...@flexbit.at>
Date: Wed, 2 May 2012 18:02:00 +0000
Subject: RE: [RavenDB] Re: how to retrieve id's of documents along with the documents themselves in RavenBD

What? You don’t have an Id property on your model classes?
Can you please show us your classes which you store inside raven.

From: ravendb@googlegroups.com [mailto:ravendb@googlegroups.com] On Behalf Of Nicolas Spontz
Sent: Mittwoch, 2. Mai 2012 20:00
To: ravendb@googlegroups.com
Subject: [RavenDB] Re: how to retrieve id's of documents along with the documents themselves in RavenBD

Actually, I do not have id inside the document. it is all in the "ravendb id" system from which I can Load any document

So I can perfectly retrieve one particular document using the id, and never added any field that relates to the storage : why pollute my model when ravendb handles it fine ?
Now I wanted to mass query them and store them in memory instead of picking them up one by one, hence the need to have access to the id to set up the memory association.

On Wednesday, May 2, 2012 7:36:19 PM UTC+2, Daniel Lang wrote:

You should have an Id property on MyType, don't you?

 
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.
Bryan Johns  
View profile  
 More options May 2 2012, 2:02 pm
From: Bryan Johns <bjo...@greendragonweb.com>
Date: Wed, 2 May 2012 13:02:46 -0500
Local: Wed, May 2 2012 2:02 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD
Why?  RavenDB auto-generates the integer ID just fine.
session.Load(Of Person)(1) works just fine.  Unless you want to use
something other than an integer for your primary key, a string is not
needed.

--
Bryan Johns
K4GDW
http://www.greendragonweb.com

Do not meddle in the affairs of dragons, for you are crunchy and taste
good with ketchup.


 
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.
Daniel Lang  
View profile  
 More options May 2 2012, 2:05 pm
From: Daniel Lang <d.l...@flexbit.at>
Date: Wed, 2 May 2012 11:05:50 -0700 (PDT)
Local: Wed, May 2 2012 2:05 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

Yes, it works. But there are some scenarios where an string is better than
an integer because it's more natural to how ravendb works internally.
Generally, you want to have your Id like "products/1".

Am Mittwoch, 2. Mai 2012 20:02:46 UTC+2 schrieb Bryan Johns:


 
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.
Nicolas Spontz  
View profile  
 More options May 2 2012, 2:08 pm
From: Nicolas Spontz <nicolas.roll...@gmail.com>
Date: Wed, 2 May 2012 11:08:28 -0700 (PDT)
Local: Wed, May 2 2012 2:08 pm
Subject: Re: [RavenDB] Re: how to retrieve id's of documents along with the documents themselves in RavenBD

This is the code part
   type Primitive =  | PBool      of bool
                     | PChar      of char
                     | PInt       of int
                     | PDouble    of double
                     | PString    of string
                     | PDate      of DateTime
                     | PArray     of FieldData<Primitive> array

And this is an exemple of the JSON generated

{
  "_tag": 0,
  "Item": {
    "_tag": 6,
    "Item": [
      {
        "fieldID": "CHAIN_TICKERS",
        "value": {
          "_tag": 6,
          "Item": [
            {
              "fieldID": "Ticker",
              "value": {
                "_tag": 4,
                "Item": "SX5E 05/18/12 C2300"
              }
            }
          ]
        }
      }
    ]
  }


 
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.
Nicolas Spontz  
View profile  
 More options May 2 2012, 2:09 pm
From: Nicolas Spontz <nicolas.roll...@gmail.com>
Date: Wed, 2 May 2012 11:09:27 -0700 (PDT)
Local: Wed, May 2 2012 2:09 pm
Subject: Re: [RavenDB] Re: how to retrieve id's of documents along with the documents themselves in RavenBD

And the Id for this field is

SX5EIndex/CHAIN_TICKERS


 
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.
Nicolas Spontz  
View profile  
 More options May 2 2012, 2:11 pm
From: Nicolas Spontz <nicolas.roll...@gmail.com>
Date: Wed, 2 May 2012 11:11:37 -0700 (PDT)
Local: Wed, May 2 2012 2:11 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

If you go the exemple from Ayende, he does not store any id either in his
models.
cf  
http://blogs.hibernatingrhinos.com/3073/ravendb-in-practice-part-2-us...

The question here is, you can Load using an ID.
But can you query, get the documents back *along with their ids*


 
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.
Chris Marisic  
View profile  
 More options May 2 2012, 2:13 pm
From: Chris Marisic <ch...@marisic.com>
Date: Wed, 2 May 2012 11:13:21 -0700 (PDT)
Local: Wed, May 2 2012 2:13 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

You lose features like the ability to query for related documents with  
Session.Advanced.DatabaseCommands.StartsWith(keyPrefix, skip, take);

The corrallary to this is you lose the ability to create meaningful
document keys like "users/1/profile" "users/1/shoppingcart". I found myself
needing the hilo key generator almost never anymore because all of my
documents generally can have semantic meaning. Some of this relates to your
domain.

In my first apps with RavenDB there was nearly zero usages of Load and even
to get a single document generally took a Query, in my current app there is
almost no usages of anything other than Load unless Query is used to
display a list of data.

If you use HiLo extensively and use INT keys, how would you load user/1's
profile? You couldn't. You'd be required to do Session.Query<Profile>(x=>
x.UserId = "user/1").


 
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.
Daniel Lang  
View profile  
 More options May 2 2012, 2:18 pm
From: Daniel Lang <d.l...@flexbit.at>
Date: Wed, 2 May 2012 11:18:54 -0700 (PDT)
Local: Wed, May 2 2012 2:18 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

Nicolas, you always need to have an Id property on your classes. They are
not part of the documents content, that's true. However, inside your C# or
F# classes you will need a property of string or numeric type that is
exactly called "Id". This is a convention which you could change if you
want to have another name for that. In any case, ravendb will populate that
Id property with the documents id after they are retrieved (no matter if
you used Load() or Query()).

The reason why Oren isn't populating the Id property before he's saving the
object in raven is that RavenDB automatically assigns id then. If your
class is called "User", then raven will pluaralize that name and append a
HiLo generated number like this: "users/1". If he wanted, he could have
specified the id by himself, but there's no reason to do so unless you have
objects which have a good natural key that is unique.

Does that make sense to you?

Am Mittwoch, 2. Mai 2012 20:11:37 UTC+2 schrieb Nicolas Spontz:


 
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.
mvmv  
View profile  
 More options May 2 2012, 2:30 pm
From: mvmv <chen...@gmail.com>
Date: Wed, 2 May 2012 11:30:00 -0700 (PDT)
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

a side question, where can I find all the available methods
in Session.Advanced.DatabaseCommands and their usage explanation?


 
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.
Daniel Lang  
View profile  
 More options May 2 2012, 2:31 pm
From: Daniel Lang <d.l...@flexbit.at>
Date: Wed, 2 May 2012 18:31:52 +0000
Local: Wed, May 2 2012 2:31 pm
Subject: RE: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

Here: https://github.com/ayende/ravendb/blob/master/Raven.Client.Lightweigh...

From: ravendb@googlegroups.com [mailto:ravendb@googlegroups.com] On Behalf Of mvmv
Sent: Mittwoch, 2. Mai 2012 20:30
To: ravendb@googlegroups.com
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

a side question, where can I find all the available methods in Session.Advanced.DatabaseCommands and their usage explanation?


 
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.
Nicolas Spontz  
View profile  
 More options May 2 2012, 2:32 pm
From: Nicolas Spontz <nicolas.roll...@gmail.com>
Date: Wed, 2 May 2012 11:32:23 -0700 (PDT)
Local: Wed, May 2 2012 2:32 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

I am ready to do whatever tweak, including wrapper or whatnot.

What bugs me, is that there is *already *an *Id* field somewhere in the
system (not in my classes), since I can use it when I load a document
As in

         let r = session.safeLoad<ReferenceValue>(storename)

That is what I do to retrieve my fields. No I want to memoize the whole
bunch to gain a few 100's ms.
There must be a way to retrieve this already existing information, which,
although semantically of no importance on the business layer, can be
technically useful for stuff like preloading.

May be there is no way, and may be there is a good reason for that, but I
have a hard time seeing it...


 
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.
mvmv  
View profile  
 More options May 2 2012, 2:34 pm
From: mvmv <chen...@gmail.com>
Date: Wed, 2 May 2012 11:34:13 -0700 (PDT)
Local: Wed, May 2 2012 2:34 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

yes, the source code is always there :)

Thanks!


 
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.
Daniel Lang  
View profile  
 More options May 2 2012, 2:37 pm
From: Daniel Lang <d.l...@flexbit.at>
Date: Wed, 2 May 2012 18:37:03 +0000
Local: Wed, May 2 2012 2:37 pm
Subject: RE: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

Believe me, there must be an Id property on your data classes that you persist in RavenDB. That’s simply the way it works.
Please refer to the documentation here to learn more about document ids: http://ravendb.net/docs/client-api/basic-operations/saving-new-docume...

From: ravendb@googlegroups.com [mailto:ravendb@googlegroups.com] On Behalf Of Nicolas Spontz
Sent: Mittwoch, 2. Mai 2012 20:33
To: ravendb@googlegroups.com
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

I am ready to do whatever tweak, including wrapper or whatnot.

What bugs me, is that there is already an Id field somewhere in the system (not in my classes), since I can use it when I load a document
As in

         let r = session.safeLoad<ReferenceValue>(storename)

That is what I do to retrieve my fields. No I want to memoize the whole bunch to gain a few 100's ms.
There must be a way to retrieve this already existing information, which, although semantically of no importance on the business layer, can be technically useful for stuff like preloading.

May be there is no way, and may be there is a good reason for that, but I have a hard time seeing it...

On Wednesday, May 2, 2012 8:18:54 PM UTC+2, Daniel Lang wrote:

Nicolas, you always need to have an Id property on your classes. They are not part of the documents content, that's true. However, inside your C# or F# classes you will need a property of string or numeric type that is exactly called "Id". This is a convention which you could change if you want to have another name for that. In any case, ravendb will populate that Id property with the documents id after they are retrieved (no matter if you used Load() or Query()).

The reason why Oren isn't populating the Id property before he's saving the object in raven is that RavenDB automatically assigns id then. If your class is called "User", then raven will pluaralize that name and append a HiLo generated number like this: "users/1". If he wanted, he could have specified the id by himself, but there's no reason to do so unless you have objects which have a good natural key that is unique.

Does that make sense to you?

Am Mittwoch, 2. Mai 2012 20:11:37 UTC+2 schrieb Nicolas Spontz:
If you go the exemple from Ayende, he does not store any id either in his models.
cf  http://blogs.hibernatingrhinos.com/3073/ravendb-in-practice-part-2-us...

The question here is, you can Load using an ID.
But can you query, get the documents back along with their ids

On Wednesday, May 2, 2012 8:05:50 PM UTC+2, Daniel Lang wrote:

Yes, it works. But there are some scenarios where an string is better than an integer because it's more natural to how ravendb works internally. Generally, you want to have your Id like "products/1".

Am Mittwoch, 2. Mai 2012 20:02:46 UTC+2 schrieb Bryan Johns:
Why?  RavenDB auto-generates the integer ID just fine.
session.Load(Of Person)(1) works just fine.  Unless you want to use
something other than an integer for your primary key, a string is not
needed.

--
Bryan Johns
K4GDW
http://www.greendragonweb.com

Do not meddle in the affairs of dragons, for you are crunchy and taste
good with ketchup.


 
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.
Chris Marisic  
View profile  
 More options May 2 2012, 2:37 pm
From: Chris Marisic <ch...@marisic.com>
Date: Wed, 2 May 2012 11:37:35 -0700 (PDT)
Local: Wed, May 2 2012 2:37 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

Session.Advanced.GetMetadataFor(document)

This will get you the full raven metadata object which I believe should
include the Id.


 
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.
Nicolas Spontz  
View profile  
 More options May 2 2012, 2:44 pm
From: Nicolas Spontz <nicolas.roll...@gmail.com>
Date: Wed, 2 May 2012 11:44:22 -0700 (PDT)
Local: Wed, May 2 2012 2:44 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

Aren't you confounding the notion of

   - an Id in the raven db system (aka, what you have in the navigation bar
   when you edit an Json object in the web interface)
   - and that you object itself need to have an Id

From what I read in the document you point ot, it say "you CAN create an id
property in your object", not you have to.
Which totally makes sense, as you can supply the id while storing stuff,
which I do :

 session.Store(rv,*storename*)

Storename is then the ravenDB id, but does not exists in my model


 
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.
Nicolas Spontz  
View profile  
 More options May 2 2012, 2:51 pm
From: Nicolas Spontz <nicolas.roll...@gmail.com>
Date: Wed, 2 May 2012 11:51:12 -0700 (PDT)
Local: Wed, May 2 2012 2:51 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

Look, may be you are right, but that would be just wrong. I can't believe
this would be the case.

...

read more »


 
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.
Daniel Lang  
View profile  
 More options May 2 2012, 2:51 pm
From: Daniel Lang <d.l...@flexbit.at>
Date: Wed, 2 May 2012 18:51:56 +0000
Local: Wed, May 2 2012 2:51 pm
Subject: RE: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

Ok,… now I understand what you meant.

You can use this:
var metadata = session.Advanced.GetMetadataFor(yourObject);
var id = metadata["@id"];

However, I would suggest to add an Id property to your class because it’s always easier.

From: ravendb@googlegroups.com [mailto:ravendb@googlegroups.com] On Behalf Of Nicolas Spontz
Sent: Mittwoch, 2. Mai 2012 20:45
To: ravendb@googlegroups.com
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

Aren't you confounding the notion of

  *   an Id in the raven db system (aka, what you have in the navigation bar when you edit an Json object in the web interface)
  *   and that you object itself need to have an Id
From what I read in the document you point ot, it say "you CAN create an id property in your object", not you have to.
Which totally makes sense, as you can supply the id while storing stuff, which I do :

 session.Store(rv,storename)

Storename is then the ravenDB id, but does not exists in my model

On Wednesday, May 2, 2012 8:37:03 PM UTC+2, Daniel Lang wrote:

Believe me, there must be an Id property on your data classes that you persist in RavenDB. That’s simply the way it works.
Please refer to the documentation here to learn more about document ids: http://ravendb.net/docs/client-api/basic-operations/saving-new-docume...

From: ravendb@googlegroups.com<mailto:ravendb@googlegroups.com> [mailto:ravendb@googlegroups.com<mailto:ravendb@googlegroups.com>] On Behalf Of Nicolas Spontz
Sent: Mittwoch, 2. Mai 2012 20:33
To: ravendb@googlegroups.com<mailto:ravendb@googlegroups.com>
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

I am ready to do whatever tweak, including wrapper or whatnot.

What bugs me, is that there is already an Id field somewhere in the system (not in my classes), since I can use it when I load a document
As in

         let r = session.safeLoad<ReferenceValue>(storename)

That is what I do to retrieve my fields. No I want to memoize the whole bunch to gain a few 100's ms.
There must be a way to retrieve this already existing information, which, although semantically of no importance on the business layer, can be technically useful for stuff like preloading.

May be there is no way, and may be there is a good reason for that, but I have a hard time seeing it...

On Wednesday, May 2, 2012 8:18:54 PM UTC+2, Daniel Lang wrote:

Nicolas, you always need to have an Id property on your classes. They are not part of the documents content, that's true. However, inside your C# or F# classes you will need a property of string or numeric type that is exactly called "Id". This is a convention which you could change if you want to have another name for that. In any case, ravendb will populate that Id property with the documents id after they are retrieved (no matter if you used Load() or Query()).

The reason why Oren isn't populating the Id property before he's saving the object in raven is that RavenDB automatically assigns id then. If your class is called "User", then raven will pluaralize that name and append a HiLo generated number like this: "users/1". If he wanted, he could have specified the id by himself, but there's no reason to do so unless you have objects which have a good natural key that is unique.

Does that make sense to you?

Am Mittwoch, 2. Mai 2012 20:11:37 UTC+2 schrieb Nicolas Spontz:
If you go the exemple from Ayende, he does not store any id either in his models.
cf  http://blogs.hibernatingrhinos.com/3073/ravendb-in-practice-part-2-us...

The question here is, you can Load using an ID.
But can you query, get the documents back along with their ids

On Wednesday, May 2, 2012 8:05:50 PM UTC+2, Daniel Lang wrote:

Yes, it works. But there are some scenarios where an string is better than an integer because it's more natural to how ravendb works internally. Generally, you want to have your Id like "products/1".

Am Mittwoch, 2. Mai 2012 20:02:46 UTC+2 schrieb Bryan Johns:
Why?  RavenDB auto-generates the integer ID just fine.
session.Load(Of Person)(1) works just fine.  Unless you want to use
something other than an integer for your primary key, a string is not
needed.

--
Bryan Johns
K4GDW
http://www.greendragonweb.com

Do not meddle in the affairs of dragons, for you are crunchy and taste
good with ketchup.


 
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.
Oren Eini (Ayende Rahien)  
View profile  
 More options May 2 2012, 3:00 pm
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Wed, 2 May 2012 22:00:21 +0300
Local: Wed, May 2 2012 3:00 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

You always get the ifs back
You can get them using session.Advanced.GetDocumentId


 
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.
Nicolas Spontz  
View profile  
 More options May 2 2012, 3:00 pm
From: Nicolas Spontz <nicolas.roll...@gmail.com>
Date: Wed, 2 May 2012 12:00:55 -0700 (PDT)
Local: Wed, May 2 2012 3:00 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

yes, and if I have to query them 1 by 1....
I'll just write a wrapper class

   type ravenstored<'T> = { mutable Id : string
                            ravenstored : 'T }

All those carefully killed lines of code going to waste ;)


 
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.
Oren Eini (Ayende Rahien)  
View profile  
 More options May 2 2012, 3:09 pm
From: "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
Date: Wed, 2 May 2012 22:09:24 +0300
Local: Wed, May 2 2012 3:09 pm
Subject: Re: [RavenDB] how to retrieve id's of documents along with the documents themselves in RavenBD

Intellisense


 
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.
Messages 1 - 25 of 53   Newer >
« Back to Discussions « Newer topic     Older topic »