Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$position push modifier support #113

Open
parkan opened this issue Jun 23, 2015 · 0 comments
Open

$position push modifier support #113

parkan opened this issue Jun 23, 2015 · 0 comments

Comments

@parkan
Copy link

parkan commented Jun 23, 2015

Add support for $position modifier as described here http://docs.mongodb.org/manual/reference/operator/update/position/

We probably just need to something like

class ModifyPushEachPositionClause(fieldName: String, position: Int, values: Traversable[_])
    extends ModifyClause(ModOps.Push) {
  override def extend(q: BasicDBObjectBuilder): Unit = {
    q.push(fieldName).add("$each", QueryHelpers.list(values)).add("$position", position).pop
  }
}

class ModifyPushEachSliceClause(fieldName: String, slice: Int, position: Int, values: Traversable[_])
    extends ModifyClause(ModOps.Push) {
  override def extend(q: BasicDBObjectBuilder): Unit = {
    q.push(fieldName).add("$each", QueryHelpers.list(values)).add("$slice", slice).add("$position", position).pop
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant