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 6928953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:15:22+00:00 2026-05-27T11:15:22+00:00

I’m trying to use MongoDB to cache some data for me, but I can’t

  • 0

I’m trying to use MongoDB to cache some data for me, but I can’t seem to get the code to return a specific collection. I can get other collections without an issue, but for this one cannot get it to work and I have no idea why. The only error that I get is:

Ambiguous discriminator 'revamp@904'

I have searched long and hard for any indication as to what this means. Here’s the code I’m using:

let GetCacheDataObject ctxName cacheName collection = 
    let ctx = new DataContext(ctxName)
    let q = Query.EQ("CacheName", BsonValue.Create(cacheName.ToString()))
    let entity =
        match ctx.Db.CollectionExists(collection) with
        | false -> null
        | _ -> ctx.Db.GetCollection(typeof<DataObject>, collection).FindOneAs<DataObject>(q)
    entity

Once it his the ‘FindAsOne’, this error gets thrown.

The DataObject is a very basic custom object to hold data. Here’s the definition:

public class DataObject:IHaveIdentifier
{
    public BsonObjectId _id { get; set; }
    //public long Id { get; set; }
    public string[] Columns { get; set; }
    public IEnumerable<object[]> Rows { get; set; }
    public string CacheName { get; set; }
    public int GetColumnIndex(string column)
    {
        for (int i = 0; i < this.Columns.Length; i++)
            if (this.Columns[i] == column)
                return i;

        return -1;
    }
}

And the IHaveIdentifier interface is pretty basic:

public interface IHaveIdentifier
{
    BsonObjectId _id { get; set; }
}

Here’s the code that was used to save the data in the first place:

member x.Save<'T when 'T :> IHaveIdentifier>(entity:'T, collection:string) =
        if (entity._id = null ) then x.Insert<'T>(entity, collection)
        else
            x.Delete(entity, collection)
            x.Insert<'T>(entity, collection)
        x.VerifyNoErrors()

let CacheDataObject<'T when 'T :> IHaveIdentifier>(entity:'T, ctxName, collection) =
    let ctx = new DataContext(ctxName)
    ctx.Save(entity, collection)

This code was working the other day then something changed and I cannot seem to figure out what is going on.

UPDATE: Added initial saving code above

  • 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-27T11:15:22+00:00Added an answer on May 27, 2026 at 11:15 am

    Brian and Robert,
    Your input helped me figure out exactly what was going on. I was able to determine that the IEnumberable Rows property was exactly the issue. I was setting the Rows to a seq. In F# Seq are lazily evaluated, which in this case meant that Rows was being set to the output value (kind of like a ref) of the function, not the actual result. Once I converted the Rows using Seq.ToArray, then everything worked as expected.

    Thanks you both so much for pointing me down the right path.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I want to construct a data frame in an Rcpp function, but when I
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have some data like this: 1 2 3 4 5 9 2 6
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text

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.