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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:10:41+00:00 2026-06-17T09:10:41+00:00

How soon will the upsert command be implemented in Meteor? And, what is the

  • 0

How soon will the upsert command be implemented in Meteor?

And, what is the best way to do the same thing in the mean time?

Something like this is what I’m doing at the moment:

if typeof ( item = Items.findOne({title:'Foo'}) ) == 'undefined'
    item = Items.insert({title:'Foo'})
else
    Items.update(item._id, {$set: {title:'Foo'}})
# do something with item
  • 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-06-17T09:10:42+00:00Added an answer on June 17, 2026 at 9:10 am

    How soon will the upsert command be implemented in Meteor?

    UPDATE: @Thomas4019 points out that upsert is now supported:

    v0.6.6

    “Add upsert support. Collection.update now supports the {upsert: true} option. Additionally, add a Collection.upsert method which returns the newly inserted object id if applicable.”

    Source: History.md

    Usage documentation: http://docs.meteor.com/#upsert

    — original answer follows —

    There is a card on the Trello Meteor Roadmap which you can vote on to indicate its importance to you: https://trello.com/c/C91INHmj

    It is currently in the “Later” list which means it will be a while before it is implemented unless it receives a lot of votes.

    The other important thing to note is that since meteor is open-source, you could implement the necessary changes yourself and submit back.


    What is the best way to do the same thing in the mean time?

    There are several solutions but which is most appropriate for your use-case is impossible to tell without more knowledge of your design.

    1. Use the code as is, add an unique index to the collection, and handle the duplicate key error if/when it arises

    2. Change design to implement explicit optimistic concurrency.

    The core of both of these solutions is the same, gracefully handle the error case. #1 is easier to implement. #2 allows for greater flexibility in how the optimistic concurrency is handled.

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

Sidebar

Related Questions

I will soon be starting a final year Engineering project, consisting of the real-time
We will soon start replacing ClearCase with Mercurial. I hear this is a good
I am worried this is a bit expensive. Plus I will soon implement a
I will soon relaunch my whole website on the same domain, and so i
I'm building a website (a community web site like digg) but we will soon
Google Docs web UI warns This document will soon be upgraded to the latest
My team will soon be launching a web app in Beta. At what point
I'm developing a PyQt program that will soon switch from an xml type backend
Our website is currently experiencing high volume download traffic. It will soon exceed the
Soon enough I will be forced to present a project in Haskell that is

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.