Giter VIP home page Giter VIP logo

Comments (6)

Elfocrash avatar Elfocrash commented on June 3, 2024

You can do that by setting MaxItemCount on the FeedOptions parameter on the Query method to the numbers you wanna have returned.

Let me know if that solves your problem.

from cosmonaut.

leonpotgieter avatar leonpotgieter commented on June 3, 2024

Hi, tx... that works perfectly. Much appreciated.

from cosmonaut.

leonpotgieter avatar leonpotgieter commented on June 3, 2024

Apologies, spoke too soon... just realised in my test dataset that I only had the number of records I requested in my test. So no, I can't limit the number of records using feedoptions.

Tried the following.. but it still returns all records.

FeedOptions feedOptions = new FeedOptions() { MaxItemCount = 2};
var _users = await _userStore.Query(feedOptions).Where(x => x.Active).ToListAsync(cancellationToken);

from cosmonaut.

Elfocrash avatar Elfocrash commented on June 3, 2024

Yeah sorry you're absolutely right. MaxItemCount is the MaxItems that will be returned per trip to the cosmosdb retrieval.

You can use LINQ's .Take() method before you call the .ToListAsync(). This will add the TOP keyword in your CosmosDB query.

from cosmonaut.

leonpotgieter avatar leonpotgieter commented on June 3, 2024

That works just fine... thank you for the prompt assistance. Much appreciated.

from cosmonaut.

Elfocrash avatar Elfocrash commented on June 3, 2024

Thanks for using Cosmonaut. If you find it cool enough make sure you star the repo. It really helps in discoverability.

Feel free to open an issue if you have any other problems.

from cosmonaut.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.