Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6333261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:25:42+00:00 2026-05-24T18:25:42+00:00

I use RavenDB 1.0.0.426 I just experienced a weird scenario when importing data from

  • 0

I use RavenDB 1.0.0.426

I just experienced a weird scenario when importing data from an external source into RavenDB:

I chose to use the same unique ID as the external source uses, prefixed with a certain string. But. When I store a document with an ID that ends with a ‘/’, raven automatically adds a number to the end of the ID, causing the document to NOT overwrite existing document stored with the same id.

I have recreated a simple scenario to cause the error:

The type I save:

public class Foo
{
    public string Id { get; set; }
    public Foo(string id)
    {
        Id = id;
    }
}

Method saving a doc with the same id 10 times and afterwards checks the document count:

public void RunTest(string id)
{
    for (int i = 0; i < 10; i++)
    {
        using (var doc = new DocumentStore() { Url = "http://pc-009:8080/" })
        {
            doc.Initialize();
            using (var session = doc.OpenSession())
            {
                session.Store(new Foo(id));
                session.SaveChanges();
            }
        }
    }

            // Wait for the data to be persisted
            Thread.Sleep(2000);

    using (var doc = new DocumentStore() { Url = "http://pc-009:8080/" })
    {
        doc.Initialize();
        using (var session = doc.OpenSession())
        {
            var foos = session.Query<Foo>();
            int fooCount = foos.Count();
            // ASSERT HERE THAT fooCount is 1
        }
    }
}

Running the method with “id1” successfully overwrites existing documents:

RunTest("id1"); // Works fine

Running method with “id1/” ends up creating 10 documents in the database:

RunTest("id1/"); // Results in multiple documents to be created

I know that if you do not define your own ID, raven will autogenerate doc-ids on the fly, but is the behavior I describe above by design?

Thankyou in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:25:43+00:00Added an answer on May 24, 2026 at 6:25 pm

    Stephan,
    This is expected, when your key ends with /, it asks ravendb to use identity generation strategy.
    See the docs here:
    http://ravendb.net/documentation/docs-api-key-generation

    If you want a key that ends with /, you can url encode the keys

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Use case: I've just entered insert mode, and typed some text. Now I want
I'm trying migrating an existing web application to use RavenDB. I currently have pages
I'm building a ASP.NET MVC site. I want to use RavenDb (www.ravendb.net) - the
I am new to RavenDB and from my understanding, when you ask for the
I want to use RavenDB with ninject in my asp.net mvc3 project, Any idea
use qcvalues_test go select [finalConc] ,[rowid] from qvalues where rowid in (select rowid from
Use case: we have some project meta-data files which we want tracked, but are
I recently started using RavenDb. I am converting a relational dbase to use RavenDb.
My scenario is this: I have a custom RavenDB membership provider that is implemented
Is there any way to tell RavenDb to use WaitForNonStaleResults mode for all queries

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.