首页 \ 问答 \ @PathParam和@QueryParam有什么区别?(What is the difference between @PathParam and @QueryParam)

@PathParam和@QueryParam有什么区别?(What is the difference between @PathParam and @QueryParam)

我是RESTful球衣的新手。 我想问一下,在@PathParam@QueryParam之间有什么区别?


I am newbie in RESTful jersey. I would like to ask what is the different between @PathParam and @QueryParam in jersey?


原文:https://stackoverflow.com/questions/5579744
更新时间:2023-07-12 14:07

最满意答案

如果您正在讨论文档中数组中的“索引”位置,那么您需要$slice运算符。 第一个参数是开始的索引,第二个参数是返回的数量。 所以从0指数位置2是“第三”指数:

 db.collection.find({},{ "list": { "$slice": [ 2, 8 ] })

如果使用.limit().skip()修饰符来移动集合中的范围,则在集合本身内:

db.collection.find({}).skip(2).limit(8)

请记住,在集合上下文中,MongoDB没有“有序”记录的概念,并且依赖于给定的查询和/或排序顺序


If you are talking about the "index" position within an array in your document then you want the $slice operator. The first argument being the index to start with and the second is how many to return. So from a 0 index position 2 is the "third" index:

 db.collection.find({},{ "list": { "$slice": [ 2, 8 ] })

Within a collection itself if you use the .limit() an .skip() modifiers to move through the range in the collection:

db.collection.find({}).skip(2).limit(8)

Keep in mind that in the collection context MongoDB has no concept of "ordered" records and is dependent on the query and/or sort order that is given

相关问答

更多
  • 从驱动程序的v2.0开始,有一个新的async API。 不应该再使用旧的API,因为它是新API的屏蔽外观,因此不推荐使用。 目前建议的创建索引的方法是使用Builders.IndexKeys通过调用并等待具有IndexKeysDefinition : static async Task CreateIndex() { var client = new MongoClient(); var database = client.GetDatabase("HamsterSchool"); ...
  • 基于你的查询,我想你的文件看起来像这样: { "_id" : 1, "lc" : "eng", "group" : "xyz", "indices" : [ { "text" : "as", "pos" : 2 }, { "text" : "text", "pos" : 4 } ] } 我使用这种格式的文档 ...
  • 如果您正在讨论文档中数组中的“索引”位置,那么您需要$slice运算符。 第一个参数是开始的索引,第二个参数是返回的数量。 所以从0指数位置2是“第三”指数: db.collection.find({},{ "list": { "$slice": [ 2, 8 ] }) 如果使用.limit()和.skip()修饰符来移动集合中的范围,则在集合本身内: db.collection.find({}).skip(2).limit(8) 请记住,在集合上下文中,MongoDB没有“有序”记录的概念,并且依赖 ...
  • 看起来这个问题已在Google网上论坛中得到解答 : 没有效率,没有。 从查询中查看explain(),看看会发生什么。 It looks like this question was answered on the Google Groups: Not efficiently, no. Take a look at the explain() from queries to see what happens.
  • 在当前的Mongoose 4.3.7版本中,您不能在方案中定义部分索引,但仍然可以使用MongoDB 3.2的部分索引。 您只需使用本机驱动程序创建索引。 // ScheduleModel is a Mongoose Model ScheduleModel.collection.createIndex({"type" : 1 } , {background:true , partialFilterExpression : { type :"g" }} , function(err , result){ ...
  • 不,在这种情况下不会使用索引。 您可以运行explain()来验证。 No, an index won't be used in that case. You can run an explain() to verify.
  • 从FAQ (强调我的): 写操作如何影响索引? 任何改变索引字段的写操作都需要更新索引以及文档本身。 如果更新导致文档增长超出分配的记录大小的文档,则MongoDB必须更新包含此文档的所有索引, 作为更新操作的一部分 。 因此,如果您的应用程序写入较多,则创建过多索引可能会影响性能。 From the FAQ (emphasis mine): How do write operations affect indexes? Any write operation that alters an indexed ...
  • 1)创建索引{restaurant:1,rank:1},这将符合您的目的。 你将避免2个索引 2)以下列格式创建文档,您可以查询所需的任何字段。 { info: [{hasParking:true}, {familyFriendly:true}], _id: rank: city: } db.restaurants.ensureIndex({info : 1}); db.restaurants.find({ info :{ hasParking:true}}) 注意Mong ...
  • 使用MongoDB的应用程序重新启动。 随后对ensureIndex()的调用是否会导致完整的重新索引? 不,它应该(如在其他所有驱动程序中)注册为无操作,因为索引已经存在。 一些驱动程序提供了一种缓存机制,可以在不进入服务器的情况下检测是否已创建索引(即Python)。 MongoDB服务器重新启动。 稍后从客户端应用程序调用ensureIndex()会重建吗? 与上面相同 是否有多个客户端会话影响了这些? 我假设根据文档,索引在整个集合中是全局的:“MongoDB在每个集合级别定义索引。” 是的索引存储 ...

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)