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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:35:03+00:00 2026-06-11T23:35:03+00:00

I am merging business databases. So I have data like id1 id2 id1 id2

  • 0

I am merging business databases.

So I have data like

id1 id2 
id1 id2
id1 id4
id1 id5
id1 id2
id4 id5
id4 id5
id4 id5
id4 id5

That sort of thing.

I want to sort that into

id1 id2
id1 id4
id1 id5
id1 id2
id4 id5

So basically if first column and the second column is the same than it’s duplicate

Do I need duplicate or just compound indexes with unique attribute will suffice? If so what would be the format of the index.

  • 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-11T23:35:04+00:00Added an answer on June 11, 2026 at 11:35 pm

    Yes, I think a unique compound index will do.

    db.collection.ensureIndex({first_column: 1, second_column: 1}, {unique: true});
    

    UPDATE: Deprecated since version 3.0.0: db.collection.ensureIndex() is now an alias for db.collection.createIndex().
    Use db.collection.createIndex() rather than db.collection.ensureIndex() to create new indexes.

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

Sidebar

Related Questions

I've just finished merging two branches that have been separated for a long time,
I have written a Python script for merging many data files in a few
I have trouble merging IronPython.dll, IronPython.Modules.dll, Microsoft.Dynamic.dll, Microsoft.Scripting.dll and Microsoft.Scripting.Metadata.dll into my application. The
I've read that merging several multiple javascript files into a single file improves performance,
I have this problem where I'm merging changes up into my integration branch but
I have a table in SQL Server 2008 that stores XML data in an
Like merging errors, or rebase errors. Does it have a unique error code?
I have problem merging two XML files. I loaded both files into two objects,
I'm merging in a remote branch that may have a lot of conflicts. How
I have problem when merging multiple XPS documents into one. When I merge them,

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.