Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 30 23:08
    gfoidl opened #2406
  • Nov 30 23:08
    gfoidl opened #2406
  • Nov 30 16:06
    kvpt opened #128
  • Nov 30 03:48

    Hawxy on master

    Update README.md (compare)

  • Nov 30 03:42

    github-actions[bot] on v7.2.0

    (compare)

  • Nov 30 03:32

    Hawxy on master

    Remove baseline dependency (#12… (compare)

  • Nov 30 03:32
    Hawxy closed #127
  • Nov 30 03:00
    Hawxy synchronize #127
  • Nov 30 02:42
    Hawxy opened #127
  • Nov 29 13:32
    oskardudycz closed #2327
  • Nov 29 13:32
    oskardudycz closed #2327
  • Nov 29 13:32

    oskardudycz on master

    Find document id members only w… Use validIdTypes collection in … (compare)

  • Nov 29 13:32

    oskardudycz on master

    Find document id members only w… Use validIdTypes collection in … (compare)

  • Nov 29 13:32
    oskardudycz closed #2391
  • Nov 29 13:32
    oskardudycz closed #2391
  • Nov 29 13:30
    oskardudycz milestoned #2391
  • Nov 29 13:30
    oskardudycz milestoned #2391
  • Nov 29 13:30
    oskardudycz milestoned #2391
  • Nov 29 13:30
    oskardudycz milestoned #2391
  • Nov 29 13:30
    oskardudycz labeled #2391
Egor Pavlikhin
@EgorPavlikhin_twitter
Looking at the sauce the default appears to be CreateOrUpdate ouch
Oskar Dudycz
@oskardudycz
Yes, if you'd like to use None then you need to specify that explicitly
Jeremy D. Miller
@jeremydmiller
@EgorPavlikhin_twitter It's CreateOrUpdate to enable quick developer starts. Check out this topic maybe: https://martendb.io/configuration/optimized_artifact_workflow.html
Jakob Stengård
@pnjakste
Hello. Does marten support PostgreSQL 14?
I was thinking about upgrading an applicaiton we have in development but i just want to know if it will break things that might effect our release date.
JT
@Hawxy
Works fine. I currently use Marten in production with 14.3.
Maciej G.
@grzybsonssg
Hi! Can I extend Marten's OrderBy with IMethodCallParser? I need to order documents by simple arithmetic expression: e.VotesUp - e.VotesDown...
Jakob Stengård
@pnjakste
In our old postgre we had the pl8 extension installed. I wonder, is this still a requirement for marten, or can you skip it?
What are the implications if you don't have plv8 installed?
Oskar Dudycz
@oskardudycz
@pnjakste it's not requirement, and it's disabled by default.
The only implication is that patching documents won't work
Jeremy D. Miller
@jeremydmiller
@grzybsonssg No, the method call parser business is only used for Where() clauses -- but feel free to open an issue for some kind of extension for this. I think we've added an OrderBy() overload extension method that lets you feed in raw SQL. That might be easier than mucking with Linq.
Or, easiest, make a read-only getter property that calculates that value and it'll get serialized into the JSON and you'll be able to order or search on that at will. Kinda like building an index for that expression
@pnjakste Here's a rundown of the functionality that won't exist w/o PLv8: https://martendb.io/documents/plv8.html.
Phillip Haydon
@phillip-haydon
i can't for the life of me figure out how to get a ToListAsync from a compiled query
Jeremy D. Miller
@jeremydmiller
@phillip-haydon The compiled query class itself just defines the SQL and the “plan” to get results out of the SQL. To run a compiled query asynchronously, it’s just this method: https://github.com/JasperFx/marten/blob/master/src/Marten/IQuerySession.cs#L204
Phillip Haydon
@phillip-haydon
so on the compiled query i would just set it to IReadOnlyList and then call ToListAsync?
Jeremy D. Miller
@jeremydmiller
Use this parent class: https://github.com/JasperFx/marten/blob/master/src/Marten/Linq/ICompiledQuery.cs#L38. Then pass that into IQuerySession.QueryAsync(compiled query) and you get Task<IReadOnlyList<T>>
Jeremy D. Miller
@jeremydmiller
There are some examples in the docs. You never have to call ToList() in the actual compiled query
Phillip Haydon
@phillip-haydon
:+1:
thanks
Oskar Dudycz
@oskardudycz
Folks, today's International Marten's Day. We'll be giving today talks with @jeremydmiller showcasing Marten. See details:
Feel invited! :)
Phillip Haydon
@phillip-haydon
bit late for me :'( do you know if its recorded?
3 replies
Oskar Dudycz
@oskardudycz
It should be
Tomas Tichy
@ttichy
Is there a way to query the MartenRegistry? I'd like to know what Subclass has been added with AddSubClass
Jeremy D. Miller
@jeremydmiller
Look off of IDocumentStore.Options. It’s a read-only view over the underlying StoreOptions. Should give you access to look at doc type by doc type.
2 replies
Sam
@iamjustsam

Hi! I have some questions regarding compiled queries

  • Should it be possible to correctly use compiled queries without parameters? When I do so and try to register the query type for code generation, it complains that the query is not a valid compiled query. If I add a parameter AND use it in the query, the registration seems to work fine.

  • Is it possible to use the tenancy helpers in a compiled query? e.g. .Where(x => x.AnyTenant()). Same situation as above, when registering the query type.

  • Should a where clause like this be possible: .Where(x => x.ChildCollection.Any())?

We have all scenario's above in compiled queries and have not had any issues with them but we are now experimenting with up-front code generation and any query that uses any of the features above fail registration with storeOptions.RegisterCompiledQueryType()

ERROR: System.ArgumentOutOfRangeException: Application.SomeCompiledQuery.<>c is not a valid Marten compiled query type (Parameter 'queryType')
   at Marten.StoreOptions.RegisterCompiledQueryType(Type queryType)
   at Application.MartenServiceCollectionExtensions.RegisterCompiledQueryTypes(StoreOptions options) in ***\Startup.Marten.cs:line 94
Jeremy D. Miller
@jeremydmiller
@iamjustsam I'm not aware of any issues like that -- and we would have fixed them if we had known. I think I need to ask you to open a GH issue with repro steps and we'll try to get any necessary fixes into 5.9. Which might be next week (definitely not this week)
1 reply
Sam
@iamjustsam
Allright, I'll try to make some clear examples and open a GH issue. Thanks!
Jeremy D. Miller
@jeremydmiller
And I can't say that I've ever tried exactly those permutations with the compiled query.
Sam
@iamjustsam
The "funny" thing is that the queries themselves actually work, it is only the registration of the types for pre-building them that fails.
Jeremy D. Miller
@jeremydmiller
Doesn't strike me as all that surprising having been the guy who implemented the compiled query feature:)
Sam
@iamjustsam
:D
Jeremy D. Miller
@jeremydmiller
At some point we should probably stick @oskardudycz 's extension methods for writing events or documents in one line of code directly against IDocumentStore / IDocumentSession and just put them in the box.
4 replies
John Tesh
@johnteshnats_twitter

hey all, trying to time constrain the events using query all raw events and running into a System.InvalidCastException: 'Can't write CLR type System.Int32 with handler type TimestampTzHandler'

var @events = _documentSession.Events
.QueryAllRawEvents()
.Where(x =>
x.MatchesSql($"data->> 'Test' = '{foo}'") &&
x.Timestamp.CompareTo(DateTimeOffset.UtcNow.AddDays(-30)) > 0);

any thoughts on how to achieve this?

Jeremy D. Miller
@jeremydmiller
Yeah, the Linq support doesn’t know anything about the CompareTo() function.
do var cutoff = DateTimeOffset.UtcNow.AddDays(-30) and
Where(x => x.Timestamp > cutoff).*******) and see if that’s any happier
1 reply
ddivita
@ddivita

We have an app that is still using Marten 3. We have an event that contains a collection of references we want to project to their own view without having separate child events. We are concerned about the volume of child events in the DB.

    public class CostAllocatedToPlantGroup : IEvent
    {
        public Guid PlantGroupId { get; set; }       
        public List<PlantReference> Plants { get; set; }         
        public decimal AmountAllocated { get; set; } 
        public Guid StreamId => PlantGroupId;

    }

    public class PlantReference
    {
       public Guid PlantId {get; set; }
       public string PlantName {get;set;}            
    }

Is it possible to project each PlantReference into its own view projection, when the CostAllocatedToPlantGroup is applied? One idea was to inject a DocumentSession to store the individual references, but there may be a better way of managing this via the event pipeline.

1 reply
craigjcox
@craigjcox
Great talks today! When appending events to a stream w Marten, is there a way to return the current/max global position of the event store? Looking for something similar to LogPosition as part of the IWriteResult for the event store client or CurrentPosition as part of the AppendResult for SqlStreamStore
Jeremy D. Miller
@jeremydmiller
Haven't looked at SqlStreamStore in years, so can't really compare. You could get that information off the StreamAction that gets returned from Append() or StartStream(), but that information wouldn't exist until after you call SaveChangesAsync();
1 reply
Jackson Cribb
@JacksonCribb
StreamAction has the version of the stream itself but not the global position, If events in the StreamAction are updated after write could you get the Sequence from the last event?
1 reply
Jeremy D. Miller
@jeremydmiller
2 replies
Why do you need that at append time by the way?
Kenny
@campaignkenny_twitter

attempting use the upsert marten/postgres feature, and running into an issue where my old model and new model have the same id -> System.InvalidOperationException: Document 'Bob.Projections.ActivityModel' with same Id already added to the session.

i would ideally like to reuse the same Id if possible. code below

    var oldModel = await GetById(organizationId, cancellationToken);

    // attempt upsert
    _documentSession.Store(model, oldModel);
Babu Annamalai
@mysticmind
Did you persist the old model already? Or is it all happening in a set of code prior to save changes?
In a session (unit of work), prior to save changes, you can’t have 2 model instances with the same Id
Babu Annamalai
@mysticmind

You could just do the below:

_documentSession.Store(model);

In this case, this will update the existing one if it exist or insert a new one if it does not exist.

Marten will match by id to update or insert accordingly.
Oskar Dudycz
@oskardudycz